ASP.NET How to send mail from web page

Go down

ASP.NET How to send mail from web page

Post  Admin on Wed Mar 03, 2010 6:16 pm

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
avatar
Admin
Admin

Posts : 256
Join date : 2008-06-06

View user profile http://debmedia.forumotion.com

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum