send mail from ASP.Net
Hai,
Check the below program to send mail message from asp.net, on problem is that, it may reach in spam!!
Imports System.Web
Imports System.Web.Mail
Imports System.Net
Imports System.Net.Mail
Protected Sub btnsendmail_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim status As Integer = sendMail("toaddress", "password", "XXXXX"
End Sub
Public Function sendMail(ByVal toadd As String, ByVal pass As String, ByVal nm As String) As Integer
Try
Dim smtpClient As New SmtpClient
smtpClient.Host = "localhost"
smtpClient.Port = 25
Dim msg As New Net.Mail.MailMessage
msg.From = New MailAddress("xxxxxxx@gmail.com")
msg.To.Add(toadd)
'Can add more toaddress, Cc and Bcc also
msg.Subject = "Haii"
msg.IsBodyHtml = True
msg.Body = "Hai " + nm + ",Your Login id is this mail address and Your pass word is :" + pass + "login now by CLICKHERE "
smtpClient.Send(msg)
Return (1)
Catch ex As Exception
Return (0)
End Try
End Function
Note: Another referance for the people who have a configured smtpmailserver. Visit this link: http://weblogs.asp.net/scottgu/archive/2005/12/10/432854.aspx