About Sending a E-mail message ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Before writing a code to send a mail using asp.net, what steps have to be taken
Like do some configuration ?
coz i'm new to .Net

your help will be appreciated.

Daniel.
 
I assume you are sending emails using your IIS.

Configuration:

You need to make sure SMTP is installed on IIS. You then need to configure
SMTP server from IIS MMC to allow it to relay messages from localhost (or
the application server if your .net app is hosted on an app server). You
need to make sure CDO.dll and CDONTS.DLL are present in the
%winpath/system32% directory (and make sure you register cdonts.dll).

Code Snippet:
Dim MyMailMessage As Mail.MailMessage = New
System.Web.Mail.MailMessage()

With MyMailMessage
.From = FromAddress
.To = EmailAddress
.Subject = "Your order has been received."
.Body = "Dear Customer" & vbCrLf & vbCrLf
.Body = .Body & "Your order has been received and
entered into our web ordering system. You can view details of your order at
"
.Body = .Body & OrderURL & vbCrLf & vbCrLf & "Thank you
for your order" & vbCrLf
.Body = .Body &
System.Configuration.ConfigurationSettings.AppSettings("ManagementName") &
vbCrLf
End With

System.Web.Mail.SmtpMail.SmtpServer =
System.Configuration.ConfigurationSettings.AppSettings("SMTPServerAddress")
System.Web.Mail.SmtpMail.Send(MyMailMessage)


HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top