Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending e-mail with ASP.NET 2.0. Remote host rejects message.

Status
Not open for further replies.

mabho

Programmer
Aug 28, 2006
11
BR
Hi. I am sending e-mail using ASP.NET 2.0 with MailMessage and SMTPClient objects. Everything works fine and the e-mail is sent normally. I get the message in my e-mail box. The problem is that my main customer does not get it. Here is the answer from his server:

"Status: 5.5.0

Diagnostic-Code: smtp;504: Helo command rejected: need fully-qualified hostname".

My ISP told me the hostname they have provided is allright.

When I send the very same message (same body and subject) from the same e-mail via webmail interface (not programatically), it reaches my customer normally. So, I assume there is something missing in the header of my message to accomplish best practices and allow it to pass my customer's e-mail server policy. Below is the code I use. Am I missing something here? Thanks a lot.


***** web.config code *****

<system.net>
<mailSettings>
<smtp from="xpto@xpto.com">
<network host="smtp.myhost.com" userName="username" port="25" password="**password**" defaultCredentials="true" />
</smtp>
</mailSettings>
</system.net>


***** send e-mail method *****

Private Sub SendEmailWithCode(ByVal RecipientEmails As ArrayList, ByVal MessageSubject As String, ByVal MessageContent As String)

' Mail message creation
Dim mmSendCode As New MailMessage
Dim strMessageTo As String

mmSendCode.Subject = MessageSubject
mmSendCode.IsBodyHtml = True
mmSendCode.Body = MessageContent

' Adds e-mail addresses.
For Each strMessageTo In RecipientEmails
If strMessageTo.Length > 0 Then
mmSendCode.To.Add(strMessageTo)
End If
Next

' Mail message send.
Dim smtpSend As New SmtpClient()
smtpSend.Send(mmSendCode)

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top