Error Using SmtpMailXControl1.SmtpMailX

mjhandmjhand Member Posts: 2
Problem
Error trying to send email from Codeunit, where exchange is installed on the Navision database server


Code
SMTPMail.SetWorkMode();
SMTPMail.SetUserID('Administrator');
SMTPMail.SetFromAdress('from.co.uk');
SMTPMail.SetHost('192.x.x.x');
SMTPMail.Addline('Body of Email');
SMTPMail.SetToAdress('to.co.uk');
SMTPMail.SetSubType(1);
SMTPMail.Send;

Error
This message is for C/AL programmers:
The call to member Send failed. SmtpMailXControl1.SmtpMailX returned the following message:
503 5.5.2 Need rcpt command

Comments

  • tlarsontlarson Member Posts: 27
    That's an SMTP error. RCPT is the recipeint. It doesn't like something about the recipient.

    Does your code actually say "SMTPMail.SetToAdress" or "SMTPMail.SetToAddress"? (the first one has one 'd' in 'Address', the second one has two). Does that make a difference?

    Tim
  • Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Here is a list of the most common SMTP-errors: http://www.massmailsoftware.com/ezine/p ... -04-30.htm
    421 Service not available, closing transmission channel (This may be a reply to any command if the service knows it must shut down)
    450 Requested mail action not taken: mailbox unavailable (E.g., mailbox busy)
    451 Requested action aborted: local error in processing
    452 Requested action not taken: insufficient system storage
    500 Syntax error, command unrecognized (This may include errors such as command line too long)
    501 Syntax error in parameters or arguments
    502 Command not implemented
    503 Bad sequence of commands
    504 Command parameter not implemented
    550 Requested action not taken: mailbox unavailable (E.g., mailbox not found, no access)
    551 User not local; please try
    552 Requested mail action aborted: exceeded storage allocation
    553 Requested action not taken: mailbox name not allowed (E.g., mailbox syntax incorrect)
    554 Transaction failed
    As error 503 means "Bad sequence of commands" I suspect the problem is the order of your SMTPMail methods and properties.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Sign In or Register to comment.