View Single Post
  #4 (permalink)  
Old January 29th, 2011, 09:49 AM
leeWozyWarren leeWozyWarren is offline
Authorized User
Points: 285, Level: 5
Points: 285, Level: 5 Points: 285, Level: 5 Points: 285, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2010
Posts: 71
Thanks: 12
Thanked 0 Times in 0 Posts
Default Same Problem

Hi,

I am having the same problem. Here is my code..

Protected Sub sendButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles sendButton.Click
If Page.IsValid Then
Dim fileName As String = Server.MapPath("~/App_Data/ContactForm.txt")
Dim mailBody As String = File.ReadAllText(fileName)

mailBody = mailBody.Replace("##Name##", Name.Text)
mailBody = mailBody.Replace("##Email##", EmailAddress.Text)
mailBody = mailBody.Replace("##PhoneHome##", PhoneHome.Text)
mailBody = mailBody.Replace("##PhoneWork##", PhoneWork.Text)
mailBody = mailBody.Replace("##Comments##", Comments.Text)

Dim myMessage As MailMessage = New MailMessage()
myMessage.Subject = "Response from web site"
myMessage.Body = mailBody

myMessage.From = New MailAddress("leewozywarren@gmail.com", "Sender Name")
myMessage.To.Add(New MailAddress("leewozywarren@gmail.com", "Receiver Name"))

Dim mySmtpClient As SmtpClient = New SmtpClient()
mySmtpClient.Send(myMessage)

Message.Visible = True
formTable.Visible = False
End If
End Sub
End Class

AND

<system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="Lee Warren &lt;leewozywarren@gmail.com&gt;">
<network enableSsl="true" userName="leewozywarren@gmail.com" password="********" host="smtp.gamil.com"/>
</smtp>
</mailSettings>
</system.net>