Last post May 16, 2008 04:01 PM by cgi_pro
May 16, 2008 10:33 AM|cgi_pro|LINK
I'm using the following sub to send email using (System.Net.Mail)
Sub SEM(ByVal from As String, ByVal recepient As String, ByVal subject As String, ByVal body As String, Optional ByVal bcc As String = "", Optional ByVal cc As String = "")
' Instantiate a new instance of MailMessage
Dim mMailMessage As New System.Net.Mail.MailMessage
' Set the sender address of the mail message
mMailMessage.From = New System.Net.Mail.MailAddress(from)
' Set the recepient address of the mail message
' Check if the bcc value is nothing or an empty string
If Not bcc Is Nothing And bcc <> String.Empty Then
' Set the Bcc address of the mail message
' Check if the cc value is nothing or an empty value
If Not cc Is Nothing And cc <> String.Empty Then
' Set the CC address of the mail message
' Set the subject of the mail message
mMailMessage.Subject = subject
' Set the body of the mail message
mMailMessage.Body = body
' Set the format of the mail message body as HTML
mMailMessage.IsBodyHtml = True
' Set the priority of the mail message to normal
mMailMessage.Priority = System.Net.Mail.MailPriority.Normal
' Instantiate a new instance of SmtpClient
Dim mSmtpClient As New System.Net.Mail.SmtpClient
mSmtpClient.Host = WC.AppSettings("HostName")
' Send the mail message
Catch ex As Exception
The thing is, when I run my .net application to send an email, there is no error message showing up, which is good, but when I go check the email I have sent to (a non-local email address such as email@example.com) I don't find it there.
I went to check my (C:\Inetpub\mailroot\Queue) on my server, I find the email message that I have sent being still there, and never being delivered.
I searched the net and I found out the following additional statement to my code might help:
mSmtpClient.DeliveryMethod = Net.Mail.SmtpDeliveryMethod.PickupDirectoryFromIis
However, it didn't. I also made sure that my SMTP server allows relying. It also allow annonymous access to it, so no need for authentication when sending emails.
So, what am I missing here to get this working?
May 16, 2008 10:43 AM|HostingASPNet|LINK
If the email address is valid, it should be delivered.
Sometimes there is some problem with Yahoo, reconfigure your SMTP service to resend email again after some time. Practice shows that in maximum of 3 attempts it will deliver the message.
May 16, 2008 04:01 PM|cgi_pro|LINK
I have left the queued email messages for hours, and still they haven't deliver.
The destination email is working fine, because it's receiving other emails from other places while at the same time those emails in queue on my server stay in that folder and never get processed.