0

I'm trying to send emails from oracle db through utl_mail package. i installed it, granted permissions to user etc. Since i dont have a comercial email server, im using a gmail account, and in order to authenticate i am running an email relay (e-mailrelay in this case, who is also running ok).

So, when i executed this procedure in pl/sql it compiled succesfuly:

begin
    UTL_MAIL.send(sender     => 'My Name "<myname@gmail.com>"',
                  recipients => 'myname@gmail.com',
                  subject    => 'Test',
                  message    => 'It works!');
end;

i oppened the account on gmail and received tihs email saying that an app tried to log in and it was blocked. so i configured gmail to accept logins from less secured apps, sent again emails but they are not arriving. I checked in gmail last accesses and didnt find anything that could reference to oracle/plsql.

what could be the reason for the unsuccesful email sending? is there a easiest way to sent with other free email server who does not require authentication?? thanks.

S.H.
  • 183
  • 9
  • What tried to log in to what? Have you checked if it got flagged as junk mail, since it might look a bit suspicious, and had (maybe) previously been blocked? – Alex Poole May 11 '16 at 17:23
  • oracle tried to log in to this account in gmail through utl_mail and emailrelay... it is not in the spam folder – S.H. May 11 '16 at 17:38
  • I think package `UTL_MAIL` is not intended to use an external SMTP server like gmail. You have to use the low-level package [UTL_SMTP](https://docs.oracle.com/database/121/ARPLS/u_smtp.htm#ARPLS074), see also this answer: http://stackoverflow.com/questions/26186179/sending-email-from-pl-sql-procedure – Wernfried Domscheit May 12 '16 at 05:53
  • @WernfriedDomscheit, I wouldn't be so sure about that since they're not authenticating from PL/SQL; instead, they are using an email relay to authenticate; so UTL_MAIL should work just as well as UTL_SMTP (UTL_MAIL uses UTL_SMTP under the covers anyway). Something else is wrong. – Jeffrey Kemp May 12 '16 at 09:03
  • @S.H., Are you really sure that your email relay has received requests to send emails? If not, check that your network ACL has been set up correctly. If your email relay is receiving requests to send but they're not going through, then you'll need to look at your email relay configuration. – Jeffrey Kemp May 12 '16 at 09:05
  • i guess so, if not how could i receive an email saying that an unsecured app tried to connect? also, when my emailrelay wasnt configured well, i got errors like 421... i set the ACL using sqlplus as sys and granted to my user how brian lech posted here: http://stackoverflow.com/questions/35744566/send-email-using-plsql/35851450#35851450 ... did i miss something? – S.H. May 12 '16 at 17:25

1 Answers1

0

Please check if you given proper grant to current user.

Try following command and check again.

grant execute on UTL_MAIL to public;
KP-
  • 32
  • 3