c# - Error sending an Email MVC -
i'm trying send email mvc application, when tried send error message "could not find part of path 'c:\temp\67088830-4abc-41c6-afbe-6856bb817889.eml'." @ line
smtp.send(mail);
any idea or suggestion on how solve error...
also code send it.
mailmessage mail = new mailmessage(); mail.to.add(configurationmanager.appsettings["to"]); mail.from = new mailaddress(configurationmanager.appsettings["from"]); mail.subject = configurationmanager.appsettings["subject"]; string body = "test"; mail.body = body; mail.isbodyhtml = true; smtpclient smtp = new smtpclient(); smtp.host = configurationmanager.appsettings["host"]; smtp.port = convert.toint32(configurationmanager.appsettings["port"]); smtp.usedefaultcredentials = false; smtp.credentials = new system.net.networkcredential (configurationmanager.appsettings["user"], configurationmanager.appsettings["pass"]); smtp.enablessl = false; smtp.send(mail);
try setting in webconfig or in file smtp delivery method network
<smtp deliverymethod="network">
Comments
Post a Comment