Hi, I am tiakang, how to do the send email in asp.net?
Helllo, I am using an outside mail service with my version. Two section in .net 2 you need to take care of the code and web.config section.
First the code (snipet)
Imports System.Net.Mail
Dim ETime
ETime = Now()
Dim OEmail
OEmail = Membership.GetUser.Email
Dim objEmail As New MailMessage
objEmail.To.Add(OEmail)
objEmail.CC.Add("MyName@YourMail.com")
objEmail.From = New MailAddress("MyName@YourMail.com")
Dim sMsg As String
sMsg = ETime + " MST" & vbCrLf
sMsg += Profile.FirstName + " " + Profile.LastName & vbCrLf
sMsg += " " & vbCrLf
sMsg += "You have now completed section 2 of the application process " & vbCrLf
sMsg += "Please upload your CV/Resume and any required credentials in section 3" & vbCrLf
objEmail.Subject = "MSI Application Process Feedback"
objEmail.Body = sMsg
Dim SmtpMail As New SmtpClient()
SmtpMail.Send(objEmail)
web.config:
Since I am using an outside source I provide the user name and password here in the web.config file.
Add this namespace
<add namespace="System.Net.Mail.SmtpClient"/>
Add the following under system.net
<system.net>
<mailSettings>
<smtp from="YourEmail@YourEmail.com">
<network host="smtpout.secureserver.net" password="YourPassword" userName="YourEmail"/>
</smtp>
</mailSettings>
</system.net>
Hope this all helps.