- Back to Home »
- Razor , Umbraco , Web.Config , XSLT »
Posted by : Jebastin
Thursday, 25 September 2014
Instead using the ASP.Net email sending code, we can use the following code to send email in Umbraco web applications.
<mailSettings>
<smtp>
<network
host="smtp.gmail.com"
port="587"
userName="email@gmail.com"
password="password"
defaultCredentials="false"
enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
<mailSettings>
<smtp>
<network
host="smtp.mail.yahoo.com"
port="465"
userName="email@yahoo.com"
password="password"
defaultCredentials="false"
enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
library.SendMail("from@email.com", "to@email.com", "Subject", "Body", false);
}
Web.Config Configuration:
Gmail SMTP Settings:
<system.net><mailSettings>
<smtp>
<network
host="smtp.gmail.com"
port="587"
userName="email@gmail.com"
password="password"
defaultCredentials="false"
enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Yahoo Mail SMTP Settings:
<system.net><mailSettings>
<smtp>
<network
host="smtp.mail.yahoo.com"
port="465"
userName="email@yahoo.com"
password="password"
defaultCredentials="false"
enableSsl="true" />
</smtp>
</mailSettings>
</system.net>
Razor:
if (IsPost) {library.SendMail("from@email.com", "to@email.com", "Subject", "Body", false);
}