Hello!
I'm having problems sending mails from APEX, I'm using XAMPP, APEX is running on an Apache Tomcat server, and I'm Mercury SMTP to send the mails. The problem is when I execute the PL/SQL code it doesn't encounter any errors, but the emails don't show up in the APEX admin mail queue, nor do they arrive at the destination email address.
Here are the PL/SQL codes I tried using.
APEX_MAIL:
create or replace procedure PROC_SEND_MAIL(p_from varchar2, p_to varchar2, p_subject varchar2, p_body varchar2)
as
l_id number;
begin
l_id := APEX_MAIL.SEND(
p_to, p_from, p_subject, p_body);
APEX_MAIL.push_queue;
commit;
end PROC_SEND_MAIL;
UTL_SMTP:
create or replace PROCEDURE SEND_SMTP (msg_to varchar2, msg_subject varchar2, msg_text varchar2 )
IS
c utl_smtp.connection;
rc integer;
msg_from varchar2(50) := 'Sender';
mailhost VARCHAR2(30) := 'My apache proxy IP address';
BEGIN
c := utl_smtp.open_connection(mailhost, 25); -- SMTP on port 25
utl_smtp.helo(c, mailhost);
utl_smtp.mail(c, msg_from);
utl_smtp.rcpt(c, msg_to);
utl_smtp.data(c,'From: Sender' || utl_tcp.crlf || 'To: ' || msg_to || utl_tcp.crlf || 'Subject: ' || msg_subject || utl_tcp.crlf || msg_text);
utl_smtp.quit(c);
EXCEPTION
WHEN UTL_SMTP.INVALID_OPERATION THEN
dbms_output.put_line(' Invalid Operation in Mail attempt
using UTL_SMTP.');
WHEN UTL_SMTP.TRANSIENT_ERROR THEN
dbms_output.put_line(' Temporary e-mail issue - try again');
WHEN UTL_SMTP.PERMANENT_ERROR THEN
dbms_output.put_line(' Permanent Error Encountered.');
end send_smtp;
Of course when I stop the Mercury SMTP I'm getting an error stating the service is not found, so I guess I configured the SMTP properly.
If it's a problem with the proxy, how do I configure the Apache httpd.conf file to know which emails should it serve?
Thanks in advance!
Regards, Tamas