import os import smtp import time // Used to test that a function call returns an error fn fn_errors(c smtp.Client, m smtp.Mail) bool { c.send(m) or { return true } return false } /* * * smtp_test * Created by: nedimf (07/2020) */ fn test_smtp() { $if !network ? { return } client_cfg := smtp.Client{ server: 'smtp.mailtrap.io' from: 'dev@vlang.io' username: os.getenv('VSMTP_TEST_USER') password: os.getenv('VSMTP_TEST_PASS') } send_cfg := smtp.Mail{ to: 'dev@vlang.io' subject: 'Hello from V2' body: 'Plain text' } mut client := smtp.new_client(client_cfg) or { assert false return } assert true client.send(send_cfg) or { assert false return } assert true // client.send({ send_cfg | body_type: .html, body: '