Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Apex mail with Gmail

Alexandre PereiraOct 13 2016 — edited Oct 14 2016

Hi,

I have a 12.1 Database with Apex 4.2.5.00.08 and I'm having problems trying to configure Google Mail SMTP options.

As a side note I'm using Google Apps as a mail provider for my domain, só that why you wont see a gmail.com mail address.

At the moment my configuration in the Administration console under Instance settings looks like this:

  • SMTP Host Address: smtp.gmail.com
  • SMTP Host Port: 587
  • SMTP Username: email@mydomain.com
  • SMTP Password: password
  • Use SSL/TLS: After connection is estabilished
  • Default Email From Address: email@mydomain.com

The error I obtain when using APEX_MAIL.SEND in aplications using these settings is:

ORA-29278:SMTP transient error: 421 Service Not available

On the other hand, using pl/sql and UTL_SMTP I am able to connect, authenticate and send an e-mail using the following settings and routine:

DECLARE

  l_con utl_smtp.Connection;

BEGIN

  l_con :=  utl_smtp.Open_connection (

   host =>  'smtp.gmail.com'

  , port =>  587

  , wallet_path =>  'file:/u01/app/oracle/product/12.1.0/dbhome_1/owm/wallets/oracle'

  , wallet_password =>  'wallet_password'

  , secure_connection_before_smtp =>  false ) ;

  utl_smtp.ehlo(l_con, 'smtp.gmail.com'); 

  utl_smtp.starttls(l_con);

 

  utl_smtp.auth(l_con,

                   'email@mydomain.com',

                   'mail_password',

                   'PLAIN');

  UTL_SMTP.mail(l_con, 'email@mydomain.com');

  UTL_SMTP.rcpt(l_con, 'personal@gmail.com');

  UTL_SMTP.data(l_con, 'Hello world!' || UTL_TCP.crlf || UTL_TCP.crlf);

  UTL_SMTP.quit(l_con);                

END;

I could be, and probably am, missing some small setting but at the moment the only diferences between my routine and the Apex instance settings that I can spot are:

I'm using a fixed PLAIN as the scheme and I'm assuming the underlying Apex flow procedure is using utl_smtp.all_schemes

And the secure_connection_before_smtp is False where in Apex I don't have a clue.

Can someone help me understand what could I be missing or the changes I need to do in order to make this work with apex_mail?

Regards,

Alexandre Pereira.

This post has been answered by Alexandre Pereira on Oct 14 2016
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 9 2023
Added on Oct 13 2016
7 comments
6,399 views