GetSMTPResponse

Retrieve the SMTP reply code and message from an SMTP response.

GetSMTPResponse(ReplyCode,ReplyMessage)

Parameters

Parameter Type Direction Description
ReplyCode Numeric Out SMTP reply code
ReplyMessage String Out Message from the SMTP server; maximum of 512 bytes.

Return Values

Values Returned in $status
Value Description
0 Success
-10 Miscellaneous error

Description

Use GetSMTPResponse after UPOPMAIL operations that provide SMTP handling, such as LogonSMTP, LogoffSMTP, SendMail, and Send, to get the response code and message from the SMTP server.

If there is no response from the SMTP server, there will be no reply code or message returned.

During the communication with an SMTP server, the UPOPMAIL component receives the response from the server and determines whether an error has occurred based on the reply code. For example, the reply codes 452 (Requested action not taken: insufficient system storage) and 552 (Requested mail action aborted: exceeded storage allocation) are considered errors, and UPOPMAIL returns -15 (Quota on server exceeded).

The reply code and message provide better information than just a negative return value, so you can use the GetSMTPResponse operation to retrieve them.

SMTP codes consist of three digits, that each have a special meaning. Reply codes that begin with 4 or 5 indicate an error that prevents the message from being sent.

Common SMTP Error Codes
Reply Code Meaning
421 Service not available, closing transmission channel
450 Requested mail action not taken: mailbox unavailable
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
535 Authentication credentials invalid
550 Requested action not taken: mailbox unavailable (for example, mailbox not found, no access)
551 User not local
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

For more information, consult the SMTP and Extended SMTP standards.

GetSMTPResponse

activate "UPOPMAIL".GetSMTPResponse(vReplyCode, vReplyMessage)

Related Topics