sending email in asp.net?

Rahul

New member
My code is running without problem , but email is not being sent .(not even in the spam section)
<smtp from="[email protected]">
in the above line of the web.config file do i have to give my own email address or senders email address or it should be ="[email protected]" or "[email protected]"
like my username in my pc is "aaa" and server name is "aaa-56acad53399" , so should it be
"[email protected]"



portion of the web.config file
<system.net>
<mailSettings deliveryMethod="Network">
<smtp from="[email protected]">
<network host="localhost" password="" userName="" />
</smtp>
</mailSettings>
</system.net>

code behind file

Try
Dim fromAddress As New MailAddress("[email protected]", "crs")
Dim toAddress As New MailAddress("[email protected]", "Rizwan Shaikh")
Dim msg As New MailMessage(fromAddress, toAddress)
msg.Subject = "crs"
msg.Body = " This message is from crs"
Dim clnt As New SmtpClient("localhost")
clnt.Send(msg)

Catch ex As SmtpException

Session("Exception") = ex

TextArea1.InnerText = ex.Message.ToString ' for debugging purposes
End Try
Response.Redirect("success.htm")


also i have set up the "default SMTP virtual server" - i have added the localhost IP adress 127.0.0.1 in the relay adresses .but still code is not working :(

do i have to change the name of the "default SMTP server" and default domain name ?

plz help asap
thnx in advance :)
 
Back
Top