how to send mail through vb.net ?
-
-
yup.. it's fairly simple... take a look at the documentation for System.Web.Mail here's a c# example:
using System.Web.Mail; ... SmtpMail.SmtpServer = "relayserveraddress"; MailMessage msg = new MailMessage(); msg.From = "from@youraddress.com"; msg.To = "to@them.com"; msg.bcc = "bcc@bcc.bcc"; msg.cc = "cc@cc.cc"; msg.Subject = "test message"; msg.Body = "this is the body of your message Formatted with HTML"; msg.BodyFormat = MailFormat.html; SmtpMail.Send(msg);
That's all there is to it. Your code has to have relay access to the smtp server. Adam
// TODO: Write code.
-
Use the System.Web.Mail.MailMessage object. This is an example in C# of how to use it, but it should easily convert to VB.NET: MailMessage mail = new System.Web.Mail.MailMessage(); mail.From = ***sender's email address***; mail.To = ***reciever's email address; mail.Subject = ***Subject***; mail.Body= ***some message***; System.Web.Mail.SmtpMail.SmtpServer = ***your email server***; System.Web.Mail.SmtpMail.Send(mail); You can .cc, .bcc, and .attachments, as well. Hope this helps