Home » SQL & PL/SQL » SQL & PL/SQL » Hi. problem in sending emails
Hi. problem in sending emails [message #134213] Tue, 23 August 2005 20:20 Go to next message
ramabhupalrr
Messages: 69
Registered: July 2005
Location: India
Member

Hi all,

I am sending the mail through the procedure in oracle 10g.

I have written the following piece of code.

mailCONN:=utl_smtp.open_connection(mailHOST, 25, mailCONN);
utl_smtp.helo(mailCONN, mailHOST);
utl_smtp.mail(mailCONN, 'ramabhupal@gmail.com');
utl_smtp.rcpt(mailCONN, 'bhupal@rediffmail.com');
utl_smtp.data('some thing............');
utl_smtp.quit(mailCONN);

In the place of mailHOST i had given 'mail.domain.com' which ip address of smtp server.

if i put the first two statements it is giving the reply code 220 and 250 reply codes.
when i put the four statements the toad not responding . can you help me?

and please tell me what ip address i have to maintain in 1st and 2nd statments.

Any suggestions will be appreciated.

thank
bhupal.
Re: Hi. problem in sending emails [message #134227 is a reply to message #134213] Wed, 24 August 2005 00:31 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
You haven't copied and pasted the code, have you? Try this:
DECLARE
  mailconn   UTL_SMTP.connection;
  mailhost   VARCHAR2 (10)       := '_enter_your_mail_server_here_';
BEGIN
  mailconn := UTL_SMTP.open_connection (mailhost, 25, 10); -- third parameter is timeout.
  UTL_SMTP.helo (mailconn, mailhost);
  UTL_SMTP.mail (mailconn, 'sender@email.address');
  UTL_SMTP.rcpt (mailconn, '_enter_your_email_address_');
  UTL_SMTP.DATA (mailconn, 'some thing............'); -- don't forget the connection (first parameter)
  UTL_SMTP.quit (mailconn);
END;
At my box, it works.

Read this first. The return codes are expected behaviour.

MHE

[Updated on: Wed, 24 August 2005 00:31]

Report message to a moderator

Re: Hi. problem in sending emails [message #134247 is a reply to message #134227] Wed, 24 August 2005 01:26 Go to previous messageGo to next message
ramabhupalrr
Messages: 69
Registered: July 2005
Location: India
Member

Hi ,

i have worked with this but i am getting the following error

ORA-29276: transfer timeout
ORA-06512: at "SYS.UTL_TCP", line 127
ORA-06512: at "SYS.UTL_TCP", line 321
ORA-06512: at "SYS.UTL_TCP", line 391
ORA-06512: at "SYS.UTL_SMTP", line 71

i had mention timeout parameter as 50


can you give suggestion for this?

thanks,
Bhupal
Re: Hi. problem in sending emails [message #134249 is a reply to message #134247] Wed, 24 August 2005 01:34 Go to previous messageGo to next message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Can you ping the server (mail host)?

MHE
Re: Hi. problem in sending emails [message #134253 is a reply to message #134249] Wed, 24 August 2005 01:39 Go to previous messageGo to next message
ramabhupalrr
Messages: 69
Registered: July 2005
Location: India
Member

Hi Maaher,

Yes, i am able to ping my server.

Thanks,
Bhupal
Re: Hi. problem in sending emails [message #134288 is a reply to message #134253] Wed, 24 August 2005 03:47 Go to previous message
Maaher
Messages: 7065
Registered: December 2001
Senior Member
Does it accept mail request? Perhaps it's a port thing.

Try increasing the timeout.

MHE
Previous Topic: alternate to cursor
Next Topic: UTL_FILE - strange problem
Goto Forum:
  


Current Time: Thu Jul 24 20:32:08 CDT 2025