Oracle PL/SQL UTL_SMTP 引发 501 5.1.7 错误的发件人地址语法

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2737762/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:32:13  来源:igfitidea点击:

Oracle PL/SQL UTL_SMTP raising a 501 5.1.7 Bad sender address syntax

oracleemailplsqlsmtp

提问by Douglas Lise

When I send e-mails using the package UTL_SMTP I am getting this error when executing the comand UTL_SMTP.MAIL:

当我使用包 UTL_SMTP 发送电子邮件时,在执行命令 UTL_SMTP.MAIL 时出现此错误:

501 5.1.7 Bad sender address syntax

I am passing olny the e-mail as second parameter. This occurs only with certain smtp servers. The code is this:

我将电子邮件作为第二个参数传递给 olny。这只发生在某些 smtp 服务器上。代码是这样的:

sFrom := '[email protected]';
Utl_Smtp.Mail(Connection, sFrom);

Does anyone know how to fix this?

有谁知道如何解决这一问题?

Thanks in advance.

提前致谢。

回答by bert

Sending email can be a bitch, see the post of the SO creator:

发邮件可能是个婊子,看 SO 创建者的帖子:

http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

http://www.codinghorror.com/blog/2010/04/so-youd-like-to-send-some-email-through-code.html

If this is only happening with some of the smtp servers, I would check the logs of those servers to see what they complain about.

如果这仅发生在某些 smtp 服务器上,我会检查这些服务器的日志以查看他们抱怨的内容。

My knowledge about SMTP is a bit dusty, but you can't just connect to a server and tell it to deliver an email with an arbitrary FROM addr. Ask your admin about details.

我对 SMTP 的了解有点模糊,但您不能只是连接到服务器并告诉它使用任意的 FROM 地址发送电子邮件。向您的管理员询问详细信息。

回答by Vincent Malgrat

can you try sFrom := '[email protected] <[email protected]>'

你能试一下吗 sFrom := '[email protected] <[email protected]>'

Some smtp servers require an address delimited by brackets <>

一些 smtp 服务器需要一个用括号分隔的地址<>