1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
SQL> create or replace procedure Envoyer_Mail (p_to in varchar2,
2 p_from in varchar2,
3 p_message in varchar2,
4 p_smtp_host in varchar2,
5 p_smtp_port in number default 25)
6 as
7 l_mail_conn utl_smtp.connection;
8 begin
9 l_mail_conn := utl_smtp.open_connection(p_smtp_host, p_smtp_port);
10 utl_smtp.command(l_mail_conn, 'STARTTLS');
11 utl_smtp.command(l_mail_conn, utl_encode.base64_encode(utl_raw.cast_to_raw('yazidi.marwen@gmail
.com')));
12 utl_smtp.command(l_mail_conn, utl_encode.base64_encode(utl_raw.cast_to_raw('mypassword')
));
13 utl_smtp.helo(l_mail_conn, p_smtp_host);
14 utl_smtp.mail(l_mail_conn, p_from);
15 utl_smtp.rcpt(l_mail_conn, p_to);
16 utl_smtp.data(l_mail_conn, p_message || utl_tcp.crlf || utl_tcp.crlf);
17 utl_smtp.quit(l_mail_conn);
18 end;
19 /
Procédure créée.
SQL> begin
2 Envoyer_Mail(p_to => 'titcha.danger@gmail.com',
3 p_from => 'yazidi.marwen@gmail.com',
4 p_message => 'Vous Avez une Panne Veuillez Consulter Administrateur Système',
5 p_smtp_host => 'smtp.gmail.com',
6 p_smtp_port => 25);
7 end;
8 /
begin
*
ERREUR à la ligne 1 :
ORA-29278: erreur passagère SMTP : 421 Service not available
ORA-06512: à "SYS.UTL_SMTP", ligne 21
ORA-06512: à "SYS.UTL_SMTP", ligne 97
ORA-06512: à "SYS.UTL_SMTP", ligne 159
ORA-06512: à "MARWEN.ENVOYER_MAIL", ligne 11
ORA-06512: à ligne 2
SQL> |
Partager