Just thought to share my code which i used to implement a simple Mail System. Hope this might help you!

Imports System.Net.Mail

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles SendEmail.Click
Dim Msg As MailMessage = New MailMessage()
Dim MailObj As New SmtpClient
Msg.From = New MailAddress(UsersEmail.Text, “Andy”)
Msg.To.Add(New MailAddress(“”, “Author”))
MailObj.Host = “”
MailObj.Port = 25
Msg.IsBodyHtml = “False”
Msg.Body = Body.Text
Msg.Subject = Subject.Text
Label1.Text = “Email Sent!”
Catch ex As Exception
Label1.Text = ex.Message
End Try
End Sub

Add your IP Address (local) in your SMTP server & under the properies add the same IP address to Relay Restrictions (Grant & deny permissions to relay email through this SMTP virutal server).

The sent email will be a spam email!

extra notes on this:

under web.config under

namespace System.Net.Mail;

string UserName = System.Configuration.ConfigurationManager.AppSettings[“smtpUsername”];
string Password = System.Configuration.ConfigurationManager.AppSettings[“smtpPassword”];
string Host = System.Configuration.ConfigurationManager.AppSettings[“smtpServer”]; string sFrom = “”;
string sTo;
string sSubject = “sample subject”;
string sBody = “sample html body“;

string toAddress = “,”;
string msgSubject = sSubject;
string msgBody = sBody;

SmtpClient client = new SmtpClient(Host);
MailAddress from = new MailAddress(sFrom);
MailAddress to = new MailAddress(toAddress);
MailMessage message = new MailMessage(from, to);
message.Priority = MailPriority.High;
message.IsBodyHtml = true;

System.Net.NetworkCredential NTLMAuthentication = new System.Net.NetworkCredential(UserName, Password);
message.Subject = msgSubject;
message.Body = msgBody;
client.UseDefaultCredentials = false;
client.Credentials = NTLMAuthentication;


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: