473,324 Members | 2,214 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Problem with System.Web.Mail.MailMessage

I use Visual Studio 2003, VB.net, NetFramework 1.4 and Windows XP

I have been using the following Code Snippet for a number of years in both Web Services and Windows Applications.
However suddenly around the 29th September 2010 it has stopped sending E-Mails from both Web Services and Windows Applications.
The same problem has happened not only to my own Network but on two other Networks, one using XP as its Server anf the other using Server 2003.
All 3 of these are using different ISPs.

Snippet**********
Imports System.Web.Mail
'
'
Dim Message As System.Web.Mail.MailMessage = New System.Web.Mail.MailMessage
Try
Message.Body = "Whatever ..."
Message.To = "My E-Mail Address"
Message.From = "Sender's E-Mail Address"
Message.Subject = "Something ..."
SmtpMail.SmtpServer.Insert(0, "127.0.0.1 or your mail server name here")
SmtpMail.Send(Message)
Catch ex As Exception
MsgBox(ex.ToString)
End Try
End Snippet ***********
'
Nothing clever and it has ALWAYS worked in the past.
Now it just doesn't send anything and doesn't generate any Exception Message.

It's not (?) Machine Setup, Program change, ISP problem, Anti-Virus Program, User, etc and I am totally at a loss to explain what has happened!

There is one possible exception/reason, all the systems affected have one thing in common - Windows Update!

Has anyone else had these problems and/or has anyone any comment or suggestions?

David Smith.
Oct 11 '10 #1
6 2594
danp129
323 Expert 256MB
Are they all pointing to the same mail server which may have been an open relay but now requires authentication?
Oct 14 '10 #2
I'm not sure what is meant by 'all pointing to the same Mail Server'. Each of the 3 machines is on a different ISP. Each points to me as the recipient. One also points to another recipient and he doesn't get his copy.

I'm also not to sure what my 'Mail server' is.
Is it the 'Outgoing SMTP Server' hosted by my ISP?

If this is the case then I get the following:

smtp:outmail.MyName.f2s.com smtp
220 smtp.f2s.tiscali.co.uk ESMTP

Not an open relay.
0 seconds - Good on Connection time
0.764 seconds - Good on Transaction time
OK - 212.74.114.25 resolves to smtp.f2s.tiscali.co.uk
OK - Reverse DNS matches SMTP Banner

The first line 'Not an open relay' looks suspicious!
Regarding the use of E-Mailing in my applications:
The principle uses are
a) to send an E-Mail to me containing the 'Exception' caught by Try/Catch if there has been an error.
b) to simply send an E-Mail, again to me, containing any comment the User wants to make. In this case one of the applications also sends an E-Mail to someone else who is using a completey different ISP.
Sorry I'm a bit vague on this but I'm a 'quick learner' when I get pointed in the right direction.

David Smith
Oct 14 '10 #3
danp129
323 Expert 256MB
Yes the mail server is from your ISP unless you're on a work network. In the snippet you provided, the mail server would be on this line:
Expand|Select|Wrap|Line Numbers
  1. SmtpMail.SmtpServer.Insert(0, "127.0.0.1 or your mail server name here")
  2.  
I really don't see that ever working.

"Not an open relay" means you have to authenticate with the mail server.

Your application should gather the following information from the user:
SMTP Mail server (Typically from ISP or work network)
SMTP Port (Usually 25)
SMTP Username (usually their e-mail address or text before "@" in e-mail address)
SMTP Password


See this example: http://support.microsoft.com/kb/555287
Oct 15 '10 #4
Thanks for your reply.
Re: "127.0.0.1 or your mail server name here") - I have never understood this but all I can say is that it has always worked up until the 29th September.
Re: Gathering information from the User - I use "f2s" as my ISP and they provide an auto-configuration for MS Outlook Mail. I had a look at Control Panel>Mail>ChangeAccount and clicked the 'Test Settings' Button and it reported all as being OK.
I didn't expect otherwise because my normal Mail is working OK.
Moreover I don't know the Mail Settings for the other two Users/ISPs therefore, since it worked in the past for them, it seems that System.Web.Mail has had no problem querying 'Data Collaboration Objects' or what-have-you without any help from me.
Again, since this problem is not confined to my Machine or my ISP and that the code has worked in the past, I have to assume that either a Microsoft Update or simultaneous changes by, at least, 3 ISPs is responsible.
Of these Microsoft Updates seems the most likely cause?
Its the only thing common to all 3 Users.
I just don't know where to go or what to try!

David Smith
Oct 15 '10 #5
danp129
323 Expert 256MB
You are correct, your code is probably fine and a windows update has probably messed it up, it's too coincidental. Unfortunately, I am not familiar with troubleshooting issues with the SMTP service on client machines. You can either troubleshoot your issue with the SMTP service not working after windows updates, or have your program bypass local pickup and send through the mail server for each users network/ISP.

For your old code, You may want to change "127.0.0.1 or your mail server name here" to just "127.0.0.1" or "localhost", as there were complaints of that string not being used for anything... Maybe a patch made that actually *do something* now and your string is improper.

To try it a different way you can try something like this:
Expand|Select|Wrap|Line Numbers
  1.         Public Shared Sub SendMail()
  2.             Dim smtpServer As String = "smtp.domain.com"
  3.             Dim userName As String = "johnDoe"
  4.             Dim password As String = "pass"
  5.             Dim cdoBasic As Integer = 1
  6.             Dim cdoSendUsingPort As Integer = 2
  7.             Dim msg As New MailMessage()
  8.             If userName.Length > 0 Then
  9.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer)
  10.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 25)
  11.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort)
  12.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic)
  13.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName)
  14.                 msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password)
  15.             End If
  16.             msg.[To] = "someone@domain.com"
  17.             msg.From = "me@domain.com"
  18.             msg.Subject = "Subject"
  19.             msg.Body = "Message"
  20.             SmtpMail.SmtpServer = smtpServer
  21.             SmtpMail.Send(msg)
  22.         End Sub
  23.  
Oct 18 '10 #6
Thanks again for your reply.
I have one more bit of information:

When I run the 'snippet' on my machine the E-Mail ends-up in C:\Inetpub\mailroot\Queue with a name like NTFS-1234567abcde.EML
Double Click this and it opens in Outlook and can be 'Forwarded'.
There must be a difference between an E-Mail sent indirectly via SMTP and one sent directly via Outlook. I suspect this difference has something to do with 'authorisation' on my XP Mail Server.
I have E-Mailed and asked Microsoft if they have any comments as to why this has suddenly happened.
With luck this may result in them advising me that a recent Windows Update is the cause and, hopefully, providing a work-around.

David Smith
Oct 18 '10 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: MrFez | last post by:
I have a simple .Net console program that sends an email message. The message can be specified as a string or a filename on the command line. Refer to the code below. The problem I am having is...
4
by: Trond A. S. Andersen | last post by:
Hi, all! I'm trying to use the System.Web.Mail. "package" combinded with System.Web.Mail.SmtpMail in order to send MS Excel spreadsheets attached to mail messages. However, sending one single...
3
by: Bart Stes | last post by:
Hey Guys, I'm trying to write a very simple thing that allows a user to send an e-mail from a windows form app. I use the System.Web.Mail MailMessage class for this and then send my e-mail...
3
by: Phil Mc | last post by:
Hi has anyone come accross the problem.... with referance to System.Web.Mail.MailMessage and System.Web.Mail.SmtpMail THIS WORKS FINE mail=new MailMessage(); mail.From =...
5
by: martin | last post by:
Hi, I have created a class that is totally seperate from my web application. However this class is used extensivly by the web application for stuff like data access. I wish to add a function to...
3
by: techie | last post by:
I'm trying to use system.web.mail to send an email, but the smtp server requires authentication. I came across some info about fields property Dim mail As New MailMessage() mail.To =...
0
by: gh0st54 | last post by:
Hi i'm looking for how to change the date of out going messages i tried this but it doesn't seems to work static public bool SendEmail(string To, string From, string Subject, string Body,...
0
by: Gerald S. | last post by:
MailMessage message = new MailMessage(from, to); message.Body = "Message body"; message.BodyEncoding = System.Text.Encoding.UTF8; message.Subject = "Subject"; message.SubjectEncoding =...
1
by: asnowfall | last post by:
I am creating MailMessage out of already existing email message. My existing message has few custom properties. I wan to add them to System.Net.Mail.MailMessage How to add custom properties? ...
0
by: Kevin Hodgson | last post by:
I'm having a problem with System.Web.Mail.MailMessage losing linefeeds when creating an email. This is a VB.NET project. I use a stringbuilder to construct the MailMessage.Body and use vbCrLf...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.