tags:

views:

292

answers:

2

using the Code Snippet for sending email in VB.Net I have successfully sent an email from my local machine, but when I Upload it to my server I get a message that the email failed. We have a national relay server that is running SMTP and I am pointed at that server in both instances. The only differance that jump out at me between the two machines is that the server is not running SMTP. Do I need SMTP to be running on the server if I am using a relay server to send the email that is running SMTP?

 Dim message As New MailMessage("[email protected]", My.Settings.NotifyList, "Starting FalconCMSOffloader @ " & My.Settings.FacID & " - " & Now, "NM")
        Dim emailClient As New SmtpClient(My.Settings.EmailServerAddress)
        emailClient.Send(message)
+1  A: 

You should not need an smtp server on the server if you specify the relay server. Double check that My.Settings.EmailServerAddress is indeed pointing to the relay server.

some
+3  A: 

You shouldn't need SMTP running locally, as the VB.Net code should just be using basic TCP/IP to communicate directly to the relay server.

It would be useful to see the error message, it is possible that the server does not have access to port 25 on the relay server (eg. due to the firewall configuration). Note that you can test this connectivity to some degree by launching telnet from the command line (on the server) as follows:

telnet RelayServerAddress 25

There is also a chance that there is some authentication happening with the relay server when you run the code locally on your machine under your domain account that isn't able to happen when the code is running on the server under a local account (I'm making some big assumptions here).

J c
Just found this on the server.12/16/2008 8:54:44 AM Blocked by port blocking rule C:\WINDOWS\system32\telnet.exe Anti-virus Standard Protection:Prevent mass mailing worms from sending mail Looks like McAfee is blocking us. Thanks.