Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 29-12-2008
Member
 
Join Date: Dec 2008
Posts: 2
send email through coding in Vb.Net

Hi,

I need to send email to different address by coding in vb.net.
please help me for this.

Thanks.
Reply With Quote
  #2  
Old 29-12-2008
Member
 
Join Date: Jan 2008
Posts: 1,515
Re: send email through coding in Vb.Net

You can use this code,

public void SendMail(String strTo, String strSubject, String strBody)
{
try
{
String strMailHost = ConfigurationManager.AppSettings["MailHost"].ToString();

SmtpClient smtp = new SmtpClient();
smtp.Host = strMailHost;

System.Net.Mail.MailMessage message = new MailMessage("Cpqs@abc.com", strTo, strSubject, strBody);
message.BodyEncoding = System.Text.Encoding.UTF8;
message.IsBodyHtml = true;
smtp.Send(message);
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
Reply With Quote
  #3  
Old 29-12-2008
Member
 
Join Date: May 2008
Posts: 2,383
Re: send email through coding in Vb.Net

HI,
Take this function to send a mail

Sub sendmail(ByVal password)

Dim objEmail As New MailMessage
objEmail.To = txtEmail.Text
objEmail.From = "abc@gmail.com"
objEmail.Subject = "Regarding Password"
objEmail.Body = "this is your new password " + password
Try
SmtpMail.Send(objEmail)
txtUserName.Text = ""
txtEmail.Text = ""
Response.Write("Your E-mail has been sent sucessfully")

Catch exc As Exception
Response.Write("Send failure: " + exc.ToString())
End Try
End Sub
__________________
The FIFA Manager 2009 PC Game
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "send email through coding in Vb.Net"
Thread Thread Starter Forum Replies Last Post
Unable to send email with jpeg's/mp3's attachment to a Verizon phone using Opera's email client Tawannah Technology & Internet 4 23-08-2011 08:04 AM
Unable to send email from email alias via Microsoft Office 365 FrancoL Windows Software 6 10-07-2011 08:26 PM
"send page by email" and "send link by email" disabled in Internet Explorer 8 Bindaas-ER Technology & Internet 4 27-02-2011 04:32 AM
Windows live mail couldn't send email but can receive email danielyen Windows Software 1 15-07-2010 12:17 AM
Cannot send internal email to a external email host like hotmail, gmail, yahoo, gmx etc... Antonio00 Small Business Server 2 14-02-2008 09:16 PM


All times are GMT +5.5. The time now is 12:42 AM.