Unable to deliver mail with Outlook SMTP using C# -


i'm trying send email c# application. i'm using smtpclient class , outlook smtp server perform operation.

here's code :

static void main(string[] args) {     string _sender = "testfrommail@outlook.com";     string _password = "mytestpassword";      smtpclient client = new smtpclient("smtp-mail.outlook.com");      client.port = 587;     client.deliverymethod = smtpdeliverymethod.network;     client.usedefaultcredentials = false;     system.net.networkcredential credentials =         new system.net.networkcredential(_sender, _password);     client.enablessl = true;     client.credentials = credentials;      mailmessage message = new mailmessage(_sender, "testtomail.com");     message.subject = "new subj";     message.body = "new body";     client.send(message); } 

my code runs without throwing exceptions.

the problem is, email doesn't delivered recipient. when open inbox of sender's mail, says mail couldn't delivered because had triggered junk filters.

screenshot of failed mail

i assume has parameter not being sent smtp client class, or security settings need configure in sender's mail.

any suggestion of great help!

error 5.4.0 means there's dns / name lookup problem. in case it's because you're trying send mail 'testtomail.com'. not valid email address.


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -