hankknight
asked on
ASP.NET/VB - Email multiple addresses
This code sends a single email to "email1@example.com". How can I send an email to three addresses:
email1@example.com
email2@example.com
email3@example.com
email1@example.com
email2@example.com
email3@example.com
Imports System.Net.Mail
Imports System.IO
Imports System.Threading
Imports System.Text.RegularExpressions
Partial Class contact_submit
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim EmailBody As StringBuilder = New StringBuilder
Dim message As MailMessage = New MailMessage(ConfigurationManager.AppSettings("ContactEmailFrom").ToString(), "email1@example.com")
EmailBody.Append("Name: " + Request.Params("Full_Name") + Environment.NewLine + Environment.NewLine)
message.IsBodyHtml = False
message.Body = EmailBody.ToString()
message.From = New System.Net.Mail.MailAddress(ConfigurationManager.AppSettings("ContactEmailFrom").ToString())
message.Subject = "Sales Inquiry"
message.ReplyTo = New MailAddress(Request.Params("Email_Address"))
Dim SmtpMail As New SmtpClient
Dim basicAuthenticationInfo As New System.Net.NetworkCredential(ConfigurationManager.AppSettings("SMTPUser").ToString(), ConfigurationManager.AppSettings("SMTPPassword").ToString())
SmtpMail.Host = ConfigurationManager.AppSettings("SMTPServer").ToString()
SmtpMail.UseDefaultCredentials = False
SmtpMail.Credentials = basicAuthenticationInfo
SmtpMail.Send(message)
End Sub
End Class
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The commas do not work but the other ideas do. Thanks.
Open in new window