Our Latest News,
Advice and Thoughts

Discover the freshest updates, insights, and authoritative perspectives in the realm of web hosting.

Inclined towards crafting a guest article for the WebHostingPeople blog? If you possess a subject you're eager to impart to our readership, we're excited to receive your contribution! Be sure to review our Guest Post Guidelines beforehand.

Our Latest News, Advice and Thoughts

System.Web.Mail Sample C# and VB .NET Script

By Admin

Share via:

The next scripts use SMTP Authentication to ship mail out of your script –

C#:
<% @Web page Language=”C#” %>
<% @Import Namespace=”System.Internet.Mail” %>
<% MailMessage mail = new MailMessage(); mail.To = “[email protected]”; mail.From = “[email protected]”; mail.Topic = “this can be a check electronic mail.”; mail.Physique = “Some textual content goes right here”; mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, “1”); //primary authentication mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, “[email protected]”); //set your username right here mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, “PASSWORD”); //set your password right here SmtpMail.SmtpServer = “localhost”; //your actual server goes right here SmtpMail.Ship( mail ); %>

VB .NET:

<% @Web page Language=”VB” %>
<% @Import Namespace=”System.Internet.Mail” %>
<% Dim mail As New MailMessage() mail.To = “[email protected]” mail.From = “[email protected]” mail.Topic = “this can be a check electronic mail.” mail.Physique = “Some textual content goes right here” mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/smtpauthenticate”, “1”) ‘primary authentication mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendusername”, “[email protected]”) ‘set your username right here mail.Fields.Add(“http://schemas.microsoft.com/cdo/configuration/sendpassword”, “PASSWORD”) ‘set your password right here SmtpMail.SmtpServer = “localhost” ‘your actual server goes right here SmtpMail.Ship(mail) %>

Reference: http://www.systemwebmail.com/faq/3.8.aspx

Leave a Comment