问题描述
Recently I moved to oracle database Release 12.1.0.2.0, while using below mentioned code for send email through utl_smtp it works fine but when the number of emails in cc increase it generate the error ora-29278 smtp transient error 421 service not available. Same code running fine on oracle Release 10.2.0.1.0. Kindly guide me which change I have to made to run the code with more then 100 numbers of email in CC. CREATE OR REPLACE PROCEDURE send_mail_image (p_to IN VARCHAR2, p_from IN VARCHAR2, p_cc IN VARCHAR2, p_subject IN VARCHAR2, p_text_msg IN VARCHAR2 DEFAULT NULL, p_attach_name IN VARCHAR2 DEFAULT NULL, p_attach_blob IN BLOB ) is conn utl_smtp.connection; BOUNDARY VARCHAR2 (256) := '-----090303020209010600070908'; i pls_integer; len pls_integer; buff_size pls_integer := 57; l_raw raw(57); p_image blob := p_attach_blob; p_smtp_host VARCHAR2(30) := '192.168.11.6'; l_message VARCHAR2(32767) := '
'||p_text_msg||''; v_emails varchar2(5000); v_pos number := 0 ; v_email varchar2(100); begin conn := utl_smtp.open_connection(p_smtp_host, 25); UTL_SMTP.helo (conn, p_smtp_host); UTL_SMTP.mail (conn, p_from); --UTL_SMTP.rcpt (conn, p_to); if p_to is not null then v_emails := p_to; Begin v_pos := instr(v_emails,';') ; if v_pos = 0 then v_emails := v_emails||';'; end if; v_pos := instr(v_emails,';') ; if v_pos > 0 then v_email := substr(v_emails,1,v_pos-1); while v_pos > 0 loop v_pos := v_pos + 1; UTL_SMTP.rcpt (conn,v_email); v_emails := substr(v_emails,v_pos); v_pos := instr(v_emails,';') ; v_email := substr(v_emails,1,v_pos-1); end loop; End if; end; v_email := null; v_emails := null; End if; if p_cc is not null then v_emails := p_cc; Begin v_pos := instr(v_emails,';') ; if v_pos = 0 then v_emails := v_emails||';'; end if; v_pos := instr(v_emails,';') ; if v_pos > 0 then v_email := substr(v_emails,1,v_pos-1); while v_pos > 0 loop v_pos := v_pos + 1; UTL_SMTP.rcpt (conn,v_email); v_emails := substr(v_emails,v_pos); v_pos := instr(v_emails,';') ; v_email := substr(v_emails,1,v_pos-1); end loop; End if; end; v_email := null; v_emails := null; End if; UTL_SMTP.open_data (conn); UTL_SMTP.write_data (conn, 'From' || ': ' || p_from || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, 'To' || ': ' || p_to || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, 'Cc' || ': ' || p_cc || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, 'MIME-Version: 1.0' || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, 'Subject: '||p_subject || UTL_TCP.CRLF) ; UTL_SMTP.write_data (conn, 'Content-Type: multipart/mixed; boundary="' || BOUNDARY || '"' || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, UTL_TCP.CRLF); UTL_SMTP.write_data (conn, '--' || BOUNDARY || UTL_TCP.CRLF ); UTL_SMTP.write_data (conn, 'Content-Type: text/html; charset=US-ASCII'|| UTL_TCP.CRLF ); UTL_SMTP.write_data (conn, UTL_TCP.CRLF); UTL_SMTP.write_data (conn, l_message); UTL_SMTP.write_data (conn, UTL_TCP.CRLF); UTL_SMTP.write_data (conn, '--' || BOUNDARY || UTL_TCP.CRLF ); UTL_SMTP.write_data (conn, 'Content-Type: image/jpg;'|| UTL_TCP.CRLF ); UTL_SMTP.write_data (conn, 'Content-Disposition: inline; filename= "'|| p_attach_name ||'"'|| UTL_TCP.CRLF); UTL_SMTP.WRITE_DATA (conn, 'Content-ID:
' || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, 'Content-Transfer-Encoding' || ': ' || 'base64' || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, UTL_TCP.CRLF); i := 1; len := dbms_lob.getlength(p_image); while i < len loop dbms_lob.read(p_image, buff_size, i, l_raw); utl_smtp.write_raw_data(conn, utl_encode.base64_encode(l_raw)); utl_smtp.write_data(conn, utl_tcp.crlf); i := i + buff_size; end loop; utl_smtp.write_data(conn, utl_tcp.crlf); UTL_SMTP.write_data (conn, '--' || BOUNDARY || '--' || UTL_TCP.CRLF); UTL_SMTP.write_data (conn, UTL_TCP.CRLF); UTL_SMTP.close_data (conn); UTL_SMTP.quit (conn); end Send_mail_image; 复制
专家解答
抱歉,我没有100可以测试的电子邮件地址。
它似乎不是接口中的固有限制,因为我对utl_smtmp.rcpt进行了500调用 (尽管所有地址都相同),没有任何问题。
因此,它 * 可能 * 是您拥有的邮件服务器/配置的限制/限制,或者 * 可能 * 是一个问题,当收件人都是不同的 (我无法真正测试)。
在任何一种情况下,让我感到奇怪的是,您将从数据库中管理它-通常对于这样的卷,您将有一个组设置作为分发列表。
但是我建议您在支持下记录电话-他们也许可以为您提供进一步的帮助。
它似乎不是接口中的固有限制,因为我对utl_smtmp.rcpt进行了500调用 (尽管所有地址都相同),没有任何问题。
因此,它 * 可能 * 是您拥有的邮件服务器/配置的限制/限制,或者 * 可能 * 是一个问题,当收件人都是不同的 (我无法真正测试)。
在任何一种情况下,让我感到奇怪的是,您将从数据库中管理它-通常对于这样的卷,您将有一个组设置作为分发列表。
但是我建议您在支持下记录电话-他们也许可以为您提供进一步的帮助。
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
Oracle DataGuard高可用性解决方案详解
孙莹
512次阅读
2025-03-26 23:27:33
Oracle RAC 一键安装翻车?手把手教你如何排错!
Lucifer三思而后行
493次阅读
2025-04-15 17:24:06
墨天轮个人数说知识点合集
JiekeXu
409次阅读
2025-04-01 15:56:03
XTTS跨版本迁移升级方案(11g to 19c RAC for Linux)
zwtian
405次阅读
2025-04-08 09:12:48
【纯干货】Oracle 19C RU 19.27 发布,如何快速升级和安装?
Lucifer三思而后行
385次阅读
2025-04-18 14:18:38
Oracle SQL 执行计划分析与优化指南
Digital Observer
385次阅读
2025-04-01 11:08:44
Oracle 19c RAC更换IP实战,运维必看!
szrsu
348次阅读
2025-04-08 23:57:08
Oracle数据库一键巡检并生成HTML结果,免费脚本速来下载!
陈举超
329次阅读
2025-04-20 10:07:02
3月“墨力原创作者计划”获奖名单公布
墨天轮编辑部
318次阅读
2025-04-15 14:48:05
oracle定时任务常用攻略
virvle
318次阅读
2025-03-25 16:05:19