c# - Sending emails (Gmail) -
this code worked few weeks ago, when try doesn't work. here's code:
smtpclient client = new smtpclient(); client.port = 587; client.host = "smtp.gmail.com"; client.enablessl = true; client.timeout = 10000; client.deliverymethod = smtpdeliverymethod.network; client.usedefaultcredentials = false; client.credentials = new system.net.networkcredential("mail@gmail.com", "password"); mailmessage mail = new mailmessage("mail@domain.com", "mail2@gmail.com", "subject", "body"); mail.bodyencoding = utf8encoding.utf8; mail.deliverynotificationoptions = deliverynotificationoptions.onfailure; client.send(mail);
error is: smtpexception unhandled: unhandled exception of type 'system.net.mail.smtpexception' occurred in system.dll
additional information: operation has timed out.
Comments
Post a Comment