philonous
September 8th, 2005, 07:19 PM
Try
Dim Msg As New MailMessage
Msg.To = "myemail@mydomain.co.uk"
Msg.Subject = TxtSubject.Text
Msg.Body = "<b><u>From</u></b>: " & TxtName.Text & "."
Msg.Body &= "<br><br>" & "<b><u>Message</u></b>: " & "<br><br>"
Msg.Body &= TxtComment.Text
Msg.From = TxtSender.Text
Msg.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Msg)
LblResult.Text = "Message sent successfully!"
Catch ex As Exception
LblResult.Text = ex.Message
End Try
The problem is that I only receive e-mails from that page if the "sender" field has the same domain as the address I'm receiving the e-mail to, the e-mail can be absolutely anything@mydomain.co.uk etc but not anything else, e.g if someone enters that their e-mail address is: "someone@hotmail.com" then it does not get sent to me whereas if they sent it as "someone@mydomain.co.uk" then I would receive it.
The "to" field cannot be seen and thus can not be changed by the user, I don't see how the sender has to say that their e-mail address is coming from the same domain I have!
What am I doing wrong???
p.s for obvious reasons I have used "mydomain.co.uk" instead of my real e-mail address but you get the picture.
Dim Msg As New MailMessage
Msg.To = "myemail@mydomain.co.uk"
Msg.Subject = TxtSubject.Text
Msg.Body = "<b><u>From</u></b>: " & TxtName.Text & "."
Msg.Body &= "<br><br>" & "<b><u>Message</u></b>: " & "<br><br>"
Msg.Body &= TxtComment.Text
Msg.From = TxtSender.Text
Msg.BodyFormat = MailFormat.Html
SmtpMail.SmtpServer = "localhost"
SmtpMail.Send(Msg)
LblResult.Text = "Message sent successfully!"
Catch ex As Exception
LblResult.Text = ex.Message
End Try
The problem is that I only receive e-mails from that page if the "sender" field has the same domain as the address I'm receiving the e-mail to, the e-mail can be absolutely anything@mydomain.co.uk etc but not anything else, e.g if someone enters that their e-mail address is: "someone@hotmail.com" then it does not get sent to me whereas if they sent it as "someone@mydomain.co.uk" then I would receive it.
The "to" field cannot be seen and thus can not be changed by the user, I don't see how the sender has to say that their e-mail address is coming from the same domain I have!
What am I doing wrong???
p.s for obvious reasons I have used "mydomain.co.uk" instead of my real e-mail address but you get the picture.