Mail is not reached
-
Hi all, Am trying to send an email from my asp.net page. Am using 5 textboxes and a button. Following is my code , After clicking the submit button it is displaying that mail sent successfully. How to ensure that mail has been reached.In my gmai maibox no msg was there. Can anybody tell me.?? Submit Button click event Dim tc, cc, bcc, subject, body As String tc = _txtTo.Text cc = _txtFrom.Text bcc = _txtBCC.Text subject = _txtSubject.Text body = _txtMessage.Text Dim status As Integer = sendMail(tc, cc, bcc, subject, body) If (status = 1) Then Response.Write("your mail has been sent successfully") Else Response.Write("sorry! your mail could not be sent�") End If My sendMail fuction Private Function sendMail(ByVal tc As String, ByVal cc As String, ByVal ccc As String, ByVal subject As String, ByVal body As String) As Integer Try SmtpMail.SmtpServer = "localhost" Dim msg As MailMessage = New MailMessage msg.From = "mymail@gmail.com" msg.Cc = cc msg.Bcc = ccc msg.Subject = subject msg.Body = body SmtpMail.Send(msg) Return 1 Catch ex As Exception Return 0 End Try End Function
kissy
-
Hi all, Am trying to send an email from my asp.net page. Am using 5 textboxes and a button. Following is my code , After clicking the submit button it is displaying that mail sent successfully. How to ensure that mail has been reached.In my gmai maibox no msg was there. Can anybody tell me.?? Submit Button click event Dim tc, cc, bcc, subject, body As String tc = _txtTo.Text cc = _txtFrom.Text bcc = _txtBCC.Text subject = _txtSubject.Text body = _txtMessage.Text Dim status As Integer = sendMail(tc, cc, bcc, subject, body) If (status = 1) Then Response.Write("your mail has been sent successfully") Else Response.Write("sorry! your mail could not be sent�") End If My sendMail fuction Private Function sendMail(ByVal tc As String, ByVal cc As String, ByVal ccc As String, ByVal subject As String, ByVal body As String) As Integer Try SmtpMail.SmtpServer = "localhost" Dim msg As MailMessage = New MailMessage msg.From = "mymail@gmail.com" msg.Cc = cc msg.Bcc = ccc msg.Subject = subject msg.Body = body SmtpMail.Send(msg) Return 1 Catch ex As Exception Return 0 End Try End Function
kissy
Hi, calling SmtpMail.Send just passes the message to your smtp-server (localhost in your case). This doesn't say anything about if the mail was "physically" send to gmail. You have to check if your smtp-server has trouble sending the mail to gmail. Have a look in the queues of your smtp-server (can be found under inetpub). Then check for errors in the event log. It could also be that gmail doesn't allow that messages are sent to them by your smtp-server (for security reasons). Let me know if you need some further help. Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
Hi, calling SmtpMail.Send just passes the message to your smtp-server (localhost in your case). This doesn't say anything about if the mail was "physically" send to gmail. You have to check if your smtp-server has trouble sending the mail to gmail. Have a look in the queues of your smtp-server (can be found under inetpub). Then check for errors in the event log. It could also be that gmail doesn't allow that messages are sent to them by your smtp-server (for security reasons). Let me know if you need some further help. Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
Thanks for ur prompt reply. Ya under inetpur,my mail messages were with msg icon. then form here what i have to do,so that i can send mail to any mail account of the user? Please dont feel trouble let me know how can i send msgs from my asp.net page. please....
kissy