How to send e-mail from Forms? [message #524927] |
Tue, 27 September 2011 09:27 |
|
shamshadvirani
Messages: 3 Registered: July 2011 Location: UAE
|
Junior Member |
|
|
Hi users
I wanted to send email from oracle 10g forms at any hotmail,yahoo and gmail so how can i send.
can any one provide me some sample code for this.
thanking you in advance.
EDITED by LF: topic renamed; was "djmartin".
As David no longer visits this forum, the original topic title was less than descriptive and utterly useless.
[Updated on: Tue, 27 September 2011 12:34] by Moderator Report message to a moderator
|
|
|
|
Re: djmartin [message #524934 is a reply to message #524930] |
Tue, 27 September 2011 10:16 |
|
Michel Cadot
Messages: 68732 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
Quote:maybe your topic title should be "send mail from forms"?
Maybe he just an answer from djmartin and from him only.
Regards
Michel
[Updated on: Tue, 27 September 2011 10:16] Report message to a moderator
|
|
|
|
Re: djmartin [message #531105 is a reply to message #531102] |
Sun, 13 November 2011 08:08 |
John Watson
Messages: 8964 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Quote:i tried to use utl_mail but it doesnt send email to yahoo, hotmil, and gmail... I have used utl_mail many times, there is no problem with yahoo/hotmail/gmail addresses: they are just addresses like any other. If you post the code you have written here, perhaps we can see the problem.
But before you do that, please read OraFAQ Forum Guide and How to use [code] tags and make your code easier to read.
As there are differences between release, please post your Oracle version, best to get it with SELECT * FROM V$VERSION;
|
|
|
Re: djmartin [message #531107 is a reply to message #531105] |
Sun, 13 November 2011 08:19 |
|
aallan
Messages: 150 Registered: October 2011
|
Senior Member |
|
|
Begin
Sys.Utl_Mail.Send (Sender => 'ahmad <ahmad@sale.com>',
Recipients '<ahmad@sale.com>,<secret.rules@live.com>',
Cc => 'ahmad@sale.com',
Bcc => 'ahmad@sale.com',
Subject => 'Oracle Test Email',
Message => 'Hi',
Mime_Type => 'text/plain; charset=us-ascii',
Priority => 1);
give me this error:ora-29279 with frm-40735
[Updated on: Sun, 13 November 2011 08:21] Report message to a moderator
|
|
|
|
Re: djmartin [message #531124 is a reply to message #531108] |
Sun, 13 November 2011 12:12 |
|
aallan
Messages: 150 Registered: October 2011
|
Senior Member |
|
|
sorry...
Begin
Sys.Utl_Mail.Send (Sender => 'ahmad <ahmad@sale.com>',
Recipients '<ahmad@sale.com>,<secret.rules@live.com>',
Cc => 'ahmad@sale.com',
Bcc => 'ahmad@sale.com',
Subject => 'Oracle Test Email',
Message => 'Hi',
Mime_Type => 'text/plain; charset=us-ascii',
Priority => 1);
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
Thank you for your help
[Updated on: Sun, 13 November 2011 13:36] Report message to a moderator
|
|
|
Re: djmartin [message #531131 is a reply to message #531124] |
Sun, 13 November 2011 16:12 |
John Watson
Messages: 8964 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
You still have not formatted your code. How can you work without indenting code and using upper and lower case correctly? And it is incomplete, where is the END; ?
However, an ORA-29279 means that the SMTP server is rejecting the message. It is not an Oracle problem. In 10g, you must set the SMTP_OUT_SERVER instance parameter. Have you set it? Is the SMTP server configured to accept messages from your database server?
|
|
|
|
Re: djmartin [message #531242 is a reply to message #531134] |
Mon, 14 November 2011 12:12 |
John Watson
Messages: 8964 Registered: January 2010 Location: Global Village
|
Senior Member |
|
|
Quote:how can i know the value of SMTP_OUT_SERVER instance parameter ?
show parameters smtp_out_server;
Quote:how can i do that (SMTP server configured to accept messages from your database server) ?
talk to your email server administrator.
|
|
|
Re: djmartin [message #531251 is a reply to message #531242] |
Mon, 14 November 2011 13:11 |
|
aallan
Messages: 150 Registered: October 2011
|
Senior Member |
|
|
dear john,
thanks for replay,
i tried to use this rprocedure:
CREATE OR REPLACE Procedure Send_Email_Test(
Pi_From In Varchar,
Pi_To In Varchar,
Pi_Cc In Varchar,
Pi_Subj In Varchar,
Pi_Msg In CLOB
)
Is
Conn Utl_Smtp.Connection;
Lv_Mailhost Varchar2(1000);
Lv_Port Number;
Begin
Lv_Mailhost := 'webmail.sale-co.com';
Lv_Port := 25;
Conn := Utl_Smtp.Open_Connection(Lv_Mailhost, Lv_Port);
Utl_Smtp.Helo(Conn, Lv_Mailhost);
Utl_Smtp.Mail(Conn, Pi_From);
Utl_Smtp.Rcpt(Conn, Pi_To);
If Pi_Cc Is Not Null Then
Utl_Smtp.Rcpt(Conn, Pi_Cc);
End If;
Utl_Smtp.Open_Data(Conn);
Utl_Smtp.Write_Data(Conn, 'MIME-version: 1.0' || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'Content-Type: multipart/alternative; charset=AL32UTF8' ||Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'Content-Transfer-Encoding: 8bit'||Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'From:' ||Pi_From || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'To:' ||Pi_To || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'Cc:' ||Pi_Cc || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'Reply-To:' ||Pi_From || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, 'Subject:' ||Pi_Subj || Utl_Tcp.Crlf);
Utl_Smtp.Write_Data(Conn, Utl_Tcp.Crlf);
--Utl_Smtp.Write_Raw_Data(Conn, Utl_Raw.Cast_To_Raw(Pi_Subj));
Utl_Smtp.Write_Raw_Data(Conn, Utl_Raw.Cast_To_Raw(Pi_Msg));
Utl_Smtp.Close_Data(Conn);
Utl_Smtp.Quit(Conn);
Exception When Others Then
Dbms_Output.Put_Line(Sqlerrm);
End;
/
and its work well, but its not supporting arabic letters !!!
can you help me with this issue ??
thanks again
|
|
|
|
|
|
|
Re: djmartin [message #531285 is a reply to message #531257] |
Mon, 14 November 2011 23:30 |
|
Michel Cadot
Messages: 68732 Registered: March 2007 Location: Saint-Maur, France, https...
|
Senior Member Account Moderator |
|
|
You have to first check that your mail software supports the arabbic characters.
Regards
Michel
|
|
|