2020-07-11 21:05:24 +02:00
|
|
|
import smtp
|
|
|
|
|
|
|
|
fn test_smtp() {
|
|
|
|
|
|
|
|
server := 'smtp.mailtrap.io'
|
|
|
|
port := 2525
|
2020-07-11 21:19:36 +02:00
|
|
|
username := ''
|
|
|
|
password := ''
|
2020-07-11 21:05:24 +02:00
|
|
|
subject := 'Hello from V'
|
|
|
|
from := 'dev@vlang.io'
|
|
|
|
to := 'dev@vlang.io'
|
|
|
|
msg := '<h1>Hi,from V module, this message was sent by SMTP!</h1>'
|
|
|
|
body_type := 'html'
|
|
|
|
debug := true //use while debugging
|
|
|
|
|
|
|
|
smtp.send_mail(server, port, username, password, subject, from, to, msg, body_type,
|
|
|
|
debug)
|
|
|
|
}
|