telnet server.domain.com 25
(25是SMTP的默认端口)
2.PL/SQL to send email sample code:
DECLARE
lc_from_email_id VARCHAR2 (100);
lc_mailhost VARCHAR2 (100) := \'abc.com\';
lc_connection UTL_SMTP.connection;
v_mail_sub VARCHAR2 (200) := \'Hello\';
v_mail_body VARCHAR2 (1000) := \'This is the mail body\';
v_from_email VARCHAR2 (100) := \'ptian@xxx.com\';
v_to_email VARCHAR2 (100) := \'ptian@xxx.com\';
BEGIN
lc_connection := UTL_SMTP.open_connection (lc_mailhost, 25);
UTL_SMTP.helo (lc_connection, lc_mailhost);
UTL_SMTP.mail (lc_connection, v_from_email);
UTL_SMTP.rcpt (lc_connection, v_to_email);
UTL_SMTP.open_data (lc_connection);
UTL_SMTP.write_data (lc_connection, \'Subject\' || \':\' || v_mail_sub || \' \' || UTL_TCP.crlf);
UTL_SMTP.write_data (lc_connection, UTL_TCP.crlf || v_mail_body || UTL_TCP.crlf);
UTL_SMTP.close_data (lc_connection);
UTL_SMTP.quit (lc_connection);
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (\'Mail not sent\');
END;
ps:可以通过下边的Query来获取SMTP Server Name
select fscpv.parameter_value smtp_server_name from fnd_svc_comp_params_tl fscpt , fnd_svc_comp_param_vals fscpv , fnd_svc_components fsc where fscpt.parameter_id = fscpv.parameter_id and fscpv.component_id = fsc.component_id and fscpt.display_name = \'Outbound Server Name\' and fsc.component_name = \'Workflow Notification Mailer\';