Home » Developer & Programmer » Forms » How to send e-mail from Forms? (Forms 10g)
How to send e-mail from Forms? [message #524927] Tue, 27 September 2011 09:27 Go to next message
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 #524930 is a reply to message #524927] Tue, 27 September 2011 09:37 Go to previous messageGo to next message
Baranor
Messages: 83
Registered: September 2011
Location: Netherlands
Member
Google offered me the following options, both of which seem valid:

Sending mail through command line from forms:
http://www.lv2000.com/cm/sendmail.htm

Java bean:
http://forms.pjc.bean.over-blog.com/article-4709413.html

Alternatively, using the database-mail system DBMS_MAIL works nicely too, allows you to send emails to users. Since I am currently in the train I'm unable to acces our own system and conjure up some source-code for the DBMS_MAIL, which I wrote (nothing much special really, a short forwarding system to allow emails to be send).

p.s. maybe your topic title should be "send mail from forms"?

[Updated on: Tue, 27 September 2011 09:37]

Report message to a moderator

Re: djmartin [message #524934 is a reply to message #524930] Tue, 27 September 2011 10:16 Go to previous messageGo to next message
Michel Cadot
Messages: 68670
Registered: March 2007
Location: Nanterre, France, http://...
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 #531102 is a reply to message #524934] Sun, 13 November 2011 07:00 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
i tried to use utl_mail but it doesnt send email to yahoo, hotmil, and gmail...
Re: djmartin [message #531105 is a reply to message #531102] Sun, 13 November 2011 08:08 Go to previous messageGo to next message
John Watson
Messages: 8939
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 Go to previous messageGo to next message
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 #531108 is a reply to message #531107] Sun, 13 November 2011 08:24 Go to previous messageGo to next message
John Watson
Messages: 8939
Registered: January 2010
Location: Global Village
Senior Member
1. I did, quite clearly, ask you to post your code properly formatted.
2. I also asked for the version of Oracle you are using.
3. You might want to consider using "please" and "thank you" Mad
Re: djmartin [message #531124 is a reply to message #531108] Sun, 13 November 2011 12:12 Go to previous messageGo to next message
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 Go to previous messageGo to next message
John Watson
Messages: 8939
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 #531134 is a reply to message #531131] Sun, 13 November 2011 23:53 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
Thanks John,
how can i know the value of SMTP_OUT_SERVER instance parameter ?
how can i do that (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 Go to previous messageGo to next message
John Watson
Messages: 8939
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 Go to previous messageGo to next message
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 #531252 is a reply to message #531251] Mon, 14 November 2011 13:40 Go to previous messageGo to next message
Michel Cadot
Messages: 68670
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
I don't think AL32UTF8 is a valid character set for smtp.
Try utf-8.

Regards
Michel
Re: djmartin [message #531253 is a reply to message #531252] Mon, 14 November 2011 13:50 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
i tried it but its not supporting arabic letters Sad
Re: djmartin [message #531256 is a reply to message #531253] Mon, 14 November 2011 14:27 Go to previous messageGo to next message
Michel Cadot
Messages: 68670
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
Why do mean by "it's not supporting arabic letters"?
What is "it"?

Regards
Michel
Re: djmartin [message #531257 is a reply to message #531256] Mon, 14 November 2011 14:33 Go to previous messageGo to next message
aallan
Messages: 150
Registered: October 2011
Senior Member
previous procedure, when i tried to send an email with arabic letters witll appeare as a rapish letters

[Updated on: Mon, 14 November 2011 14:35]

Report message to a moderator

Re: djmartin [message #531285 is a reply to message #531257] Mon, 14 November 2011 23:30 Go to previous message
Michel Cadot
Messages: 68670
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator
You have to first check that your mail software supports the arabbic characters.

Regards
Michel
Previous Topic: Changing Message Type
Next Topic: add date column
Goto Forum:
  


Current Time: Thu Aug 01 06:45:22 CDT 2024