Last post Apr 26, 2008 03:21 PM by young345
Apr 26, 2008 11:25 AM|young345|LINK
im trying to create a contact us page using the tutorial provided by the asp.net website, however i dont really understand how the SMTP works, and this why my error is occuring. i dont have a webserver as im running my application locally, does anyone know
how i can work my way around this?
any help or advice would be much appreciated
Apr 26, 2008 01:16 PM|Prof_Teancum|LINK
SMTP is really easy to use. Just import the System.Net.Mail namespace into your codefile, then use something similar to this:
Dim smtp As SmtpClient = New SmtpClient("HostIPAddress") 'Put in the IP Address of your Mail Server here
Dim UserName As String = "EmailAuthenticateUserName"
Dim Password As String = "EmailAuthenticatePassword"
Dim NetworkCredential As New System.Net.NetworkCredential(UserName, Password)
smtp.Credentials = NetworkCredential
Dim objMM As New MailMessage("EmailFromAddress", "EmailToAddress")
Dim Body As String = textcontent
objMM.IsBodyHtml = True
objMM.Subject = MailSubject
objMM.Body = textcontent
If the people are sending you an email, just use your email address for to and from addresses. As long as your mail server supports remote authentication, it should work easily.
Apr 26, 2008 03:21 PM|young345|LINK
thanks for your reply, i worked out what my mail server was, however when i input an email address the message is from, it throws an error saying that it doesnt recognise that email add, can you see why this is happening