SMTP Mail Problem

  • Thread starter Thread starter Joe
  • Start date Start date
J

Joe

I am attempting to send an SMTP mail from my VB.NET program
using the code below. The code compiles and runs fine executes with
no errors, but I am sending to one of my alternate addresses and the e-
mail is not arriving.

I was thinking that if there was something fundamentally wrong
with my host servername or credentials, that the SMTPClient class
would throw an SMTPException, but it does not. According to Microsoft
Outlook, my outgoing server does not require authentication, and
sending e-mails from there works fine for me.

Can anyone tell me what I am doing wrong in my code below?

Private Sub SendEMailResponse(ByVal sReplyToAddress As String, ByVal
sResponseText As String)
Dim smtpCrawler As New SmtpClient
Dim ResponseEMail As New MailMessage
Dim FromAddress As New MailAddress("(e-mail address removed)",
"My Display Name")
Dim ToAddress As New MailAddress(sReplyToAddress)

smtpCrawler.Host = "smtp.west.cox.net"
smtpCrawler.Port = 25

With ResponseEMail
.From = FromAddress
.To.Add(ToAddress)
.Subject = "This is a test"
.Body = sResponseText
End With

Try
smtpCrawler.UseDefaultCredentials = False
smtpCrawler.Credentials = New
NetworkCredential("MyUsername", "MyPassword")
smtpCrawler.Send(ResponseEMail)
MsgBox("E-mail response successfully sent.")
Catch ex As SmtpException
MsgBox(ex.Message, MsgBoxStyle.Critical)
End Try

End Sub
 
Is your server an exchange server ?

In the case that the answer is yes , make sure that SMTP is actually
availlable on the local domain

test this like this

Open an command prompt, and enter this command:

C:\WINDOWS>telnet smtp.west.cox.net 25

after a short time the answer will be

220 this string will vary but is mostlly a versioning string and something
like "SMTP Mail Server Ready"

If you do not see the above but an error or timeout or whatsoever , well
then contact your system administrator cause he needs to setup
a virtuall smtp in the local network from the exchange server .

If the server does respond , then make sure you are not breaking anny of the
exchange paranoia rules for instance like trying to send an e-mail where
the senders domain name is non existent in the exchange domain list (
there will be no error the mail is just not send , hey that sounds familiar
:-) )

if it was authentication then you should have got an error , but before i go
anny further you might test the above first

HTH

Michel Posseth
 
According to this is does require authentication:

http://support.cox.com/sdccommon/asp/contentredirect.asp?sprt_cid=a40....

  In that case it's also not port 25. Typically it's
port 587 but the page linked above seems to
indicate it's port 465. If you thought it didn't
need authentication then why are you sending
your password?

Because nothing else that I was trying was working, so I gave it a
username and password as a last resort. Thank you everyone for your
responses, I will give them all a try.

J
 
Because nothing else that I was trying was working, so I gave it a
username and password as a last resort.   Thank you everyone for your
responses, I will give them all a try.

J

I did the telnet thing recommended above and I got back this string
"220...cox.net biznetsmtp ESMTP server ready"

so I assume that this means that I am talking to an SMTP server.

J
 
Back
Top