TurgayK
  • TurgayK
  • 53% (Neutral)
  • Newbie Topic Starter
3 years ago
Hello,

I am trying to send an email through EASendMail but receive 501 5.5.4 Invalid Address error.
here is my code.
Dim mailAdresses As String = "mymail@company.com"
Dim recipients As AddressCollection = New AddressCollection()
recipients.AddRange(New AddressCollection(mailAdresses))

Dim address As EASendMail.MailAddress = TryCast(recipients(0), EASendMail.MailAddress)
mail.[To].Add(address)

I try also this.
Dim mailAdresses As String = "mymail@company.com"
mail.To = New AddressCollection(mailAdresses)

Nothing helps.
Anyone has any idea?

Thanks.
ivan
  • ivan
  • 100% (Exalted)
  • Administration
3 years ago
did you set your sender address, you can generate a log file with LogFileName property to get more detail, please don't paste your log content here for security.

https://www.emailarchitect.net/easendmail/kb/vbnet.aspx?cat=0#other-error-returned-by-smtp-server 
TurgayK
  • TurgayK
  • 53% (Neutral)
  • Newbie Topic Starter
3 years ago
I found out what caused the problem and it was the server.
Here is my code.

Dim mailServer As String = "X.X.X.X" '(IP Address)
Dim smtp As SmtpClient = New SmtpClient()
Dim server As SmtpServer = New SmtpServer(mailServer, 25)

server.UseDefaultCredentials = True
server.ConnectType = SmtpConnectType.ConnectTryTLS
smtp.Connect(server)

and if i delete ConnectType section the error turns to "The requested name is valid, but no data of the requested type was found"

Really annoying.
TurgayK
  • TurgayK
  • 53% (Neutral)
  • Newbie Topic Starter
3 years ago
by adding these two lines which is down below solved my problem.
Thanks

server.HeloDomain
server.MailFrom

EXPLORE TUTORIALS

© All Rights Reserved, AIFEI Software Limited & AdminSystem Software Limited.