ASP.NET How to send mail from web page
Page 1 of 1
ASP.NET How to send mail from web page
Modify the web.config file like this inside <configuration> Tag:
<system.net>
<mailSettings>
<smtp from="admin@elite-coed.org">
<network host="smtp.gmail.com" port="587" userName="admin@elite-coed.org" password="sud123@"/>
</smtp>
</mailSettings>
</system.net>
Then write this code:
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress(Email.Text))
Mailmsg.From = New System.Net.Mail.MailAddress("admin@elite-coed.org")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = Pass.Text
'obj.Host = "smtp.elite-coed.org"
obj.EnableSsl = True
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try
<system.net>
<mailSettings>
<smtp from="admin@elite-coed.org">
<network host="smtp.gmail.com" port="587" userName="admin@elite-coed.org" password="sud123@"/>
</smtp>
</mailSettings>
</system.net>
Then write this code:
Dim obj As System.Net.Mail.SmtpClient = New System.Net.Mail.SmtpClient
Dim Mailmsg As New System.Net.Mail.MailMessage
Mailmsg.To.Clear()
Mailmsg.To.Add(New System.Net.Mail.MailAddress(Email.Text))
Mailmsg.From = New System.Net.Mail.MailAddress("admin@elite-coed.org")
Mailmsg.Subject = "(subject text)"
Try
Mailmsg.Body = Pass.Text
'obj.Host = "smtp.elite-coed.org"
obj.EnableSsl = True
obj.Send(Mailmsg)
Catch ex As Exception
Response.Write("Error: " & ex.ToString())
End Try
Similar topics
» have to send a message to every computer in the school
» ASP.NET - How to refresh a page from another page
» ASP.NET to get one variable value to another page
» Asp.net Disabling Tab Key in Page
» Closing Asp.net Page Session
» ASP.NET - How to refresh a page from another page
» ASP.NET to get one variable value to another page
» Asp.net Disabling Tab Key in Page
» Closing Asp.net Page Session
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum