How to send email if SMTP is not uploading to server?

using code snippet to send email to VB.Net. I have successfully sent an email from my local computer, but when I upload it to my server, I get a message that the email failed. We have a national relay server running SMTP and I point to that server in both cases. The only difference that jumps at me between the two machines is that SMTP is not running on the server. Do I need SMTP to run on the server if I am using a relay server to send email that is running SMTP?

 Dim message As New MailMessage("DoNotReply@faa.gov", My.Settings.NotifyList, "Starting FalconCMSOffloader @ " & My.Settings.FacID & " - " & Now, "NM")
        Dim emailClient As New SmtpClient(My.Settings.EmailServerAddress)
        emailClient.Send(message)

      

0


source to share


2 answers


You don't need SMTP to run locally, as the VB.Net code should just use basic TCP / IP to communicate directly with the relay server.

It would be helpful to see an error message, it is possible that the server does not have access to port 25 on the relay server (for example, due to the configuration of the firewall). Note that you can test this connection to some extent by running telnet from the command line (on the server) as follows:



telnet RelayServerAddress 25

      

There is also the possibility that some authentication happens to the relay server when you run the code locally on your machine under a domain account, which cannot happen when the code is executed on the server under a local account (I'm making some big assumptions here).

+3


source


You don't need an smtp server on the server if you specify a relay server. Double check that My.Settings.EmailServerAddress is indeed pointing to the relay server.



+1


source







All Articles