Skip to Main Content

Oracle Forms

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Using Yahoo's SMTP to send email via forms

679006Jan 15 2009 — edited Jan 17 2009
Forms [32 Bit] Version 9.0.4.0.19 (Production)
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Oracle Toolkit Version 9.0.4.0.31 (Production)
PL/SQL Version 9.0.1.5.1 (Production)
Oracle Procedure Builder V9.0.3.5.0 Build #1641 - Production
PL/SQL Editor (c) WinMain Software (www.winmain.com), v1.0 (Production)
Oracle Query Builder 9.0.4.0.6 - Production
Oracle Virtual Graphics System Version 9.0.1.11.0 (Production)
Oracle Tools GUI Utilities Version 9.0.4.0.11 (Production)
Oracle Multimedia Version 9.0.4.0.11 (Production)
Oracle Tools Integration Version 9.0.4.0.0 (Production)
Oracle Tools Common Area Version 9.0.2.12.0
Oracle CORE 9.0.1.5.1 Production



Hello everyone, I'm using this code to connect to Yahoo! smtp mail server and send an email, first I am initiating a handshake to authenticate my connection, then I am sending the email, I am currently getting the error ora-06502.

Note: I tried both ports 25 and 587.
Also, please note that the PC I'm working on is connected to the internet but I still have to open the OC4J instanc for the form to run.


declare -- variable to hold the smtp server connection
v_smtp_connection utl_smtp.connection;
-- variable to hold the contents of the email message
v_smtp_host VARCHAR2(100) DEFAULT 'smtp.mail.yahoo.com';
-- variable to hold the smtp port
v_smtp_port NUMBER DEFAULT 587;


begin
-- establish the connection to the smtp server
v_smtp_connection := utl_smtp.open_connection('smtp.mail.yahoo.com', 587);

-- perform a handshake with the smtp server
utl_smtp.helo(v_smtp_connection, 'smtp.mail.yahoo.com');

utl_smtp.command(v_smtp_connection, 'AUTH LOGIN');
utl_smtp.command(v_smtp_connection, utl_encode.base64_encode(utl_raw.cast_to_raw('mail@yahoo.com')));
utl_smtp.command(v_smtp_connection, utl_encode.base64_encode(utl_raw.cast_to_raw('MYpassword')));

-- set the 'from' address of the message
utl_smtp.mail(v_smtp_connection, 'mail@yahoo.com');

-- add the recipient to the message
utl_smtp.rcpt(v_smtp_connection, 'mail@gmail.com');

-- open the message for writing
utl_smtp.open_data(v_smtp_connection);

-- populate the message with the build up message header and body
utl_smtp.write_data(v_smtp_connection,'lolz');

-- close the message for writing
utl_smtp.close_data(v_smtp_connection);

-- end the connection to the smtp server
utl_smtp.quit(v_smtp_connection);

end;


ANY help is greatly appreciated. Obviously I don't have an SMTP server but I should be fine connected to Yahoo! Mail and it doesn't require SSL.

Thanks in advance.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Feb 14 2009
Added on Jan 15 2009
19 comments
2,329 views