Forum Stats

  • 3,783,024 Users
  • 2,254,721 Discussions
  • 7,880,247 Comments

Discussions

Unable to send mail with apex_mail.send, mail configured correctly, no error, no mail


I am using Apex 21.2, on XE 21c database.

I've tried to send email with  apex_mail.send procedure.

Mail is in APEX_210200.WWV_FLOW_MAIL_QUEUE table, but after executing  apex_mail.push_queue procedure mail is not sent, and there is no error shown.

If I use UTL_SMTP package, I am able to send email. (meaning that ACL and SMTP are configured correctly).

In form "Manage Instance -> Mail Queue" of Apex instance admin I have "Mail Send Count"=0. When I try to Force Send Mail, I receive message : Successfully sent mail., but nothing happens.


Any suggestion is welcome!

Regards

Milan

Tagged:

Answers

  • askMax
    askMax Member Posts: 345 Gold Badge

    Hi Milan

    Did you try to execute the APEX_INSTANCE_ADMIN.VALIDATE_EMAIL_CONFIG API?

    BEGIN
        APEX_INSTANCE_ADMIN.VALIDATE_EMAIL_CONFIG;
    END;
    

    When you send an email using UTL_SMTP it will use the user's ACL. When you send one using APEX_MAIL, it will use the corresponding APEX user (APEX_210200) instead.

    Regards

    Max

  • Billy Verreynne
    Billy Verreynne Software Engineer Member Posts: 28,655 Red Diamond
    edited Dec 8, 2021 6:16AM

    https://datatracker.ietf.org/doc/html/rfc5321 is the RFC 5321 specification for the SMTP protocol.

    UTL_SMTP (which is what both APEX and UTL_MAIL uses) is an interface that talks Simple Mail Transfer Protocol to a mail server.

    This entails saying hello to the mail server (HELO command), telling it from who the e-mail is (MAIL FROM command), to whom the e-mail needs to be send to (RCPT TO command), and giving it the e-mail to forward for delivery (DATA command).

    The mail server either accepts a command, or rejects a command. If no errors are reported by UTL_SMTP, all the commands send to the mail server were accepted.

    This implies the mail was received by the mail server, and will be processed and forwarded for delivery.

    Any errors encountered after this during e-mail processing are not reported to UTL_SMTP. It successfully transmitted the mail to the mail server. What happens with the e-mail after that, what errors it encounters, are unknown to the UTL_SMTP interface, and not part of the SMTP protocol specification.