Microsoft
Software
Hardware
Network
Question : Sending email from ASP.Net 2.0
Please give me the code to send an email from my website using gmail.
I wrote the following code, but it didnt work. The exception asked for STARTLS secure connection.
Imports System.Net.Mail
Imports System.Net
Partial Class WriteToUs
Inherits System.Web.UI.Page
Public Sub ps_SendMail()
Dim objMail As System.Net.Mail.MailMessag
e
Dim objSMTPClient As New System.Net.Mail.SmtpClient
objMail = New System.Net.Mail.MailMessag
e
objMail.To.Add("
[email protected]
m")
objMail.CC.Add("abc@hotmai
l.com")
objMail.From = New MailAddress("
[email protected]
")
objMail.Body = "test message"
objSMTPClient.Host = "smtp.gmail.com"
objSMTPClient.Credentials = New NetworkCredential("abc@abc
.com", "abc123")
Try
objSMTPClient.Send(objMail
)
Catch ex As Exception
End Try
End Sub
Protected Sub form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles form1.Load
Call ps_SendMail()
End Sub
End Class
Answer : Sending email from ASP.Net 2.0
I've tested this in some of my projects and it works fine.
http://www.codeproject.com
/KB/IP/
Sen
ding_Email
s_From_GMA
IL.aspx
Hope that helps.
Random Solutions
IIS 6.0 asp.net 2.0 cpu performance issue
LWAP are unable to join Cisco Wieeless Controller 4400
how to deal with more then one Document Class !
Reset display resolution windows 7
Arcserve 11.5 and LTO 5
onmouseover is not working in Mozilla
Public Desktop Icons not showing in RDP sessions
how to rename a file before saving it after uploading in c#
Joomla SEF URLs
Error: "The site <sitename> could not be found in the Web application SPWebApplication Name=MOSS Parent=SPWebService"