web2py中的mail.send()功能用于弹出的电子邮件/电子邮件地址,不存在 [英] mail.send() feature in web2py for bounced email/ email address that doesnt exist

查看:199
本文介绍了web2py中的mail.send()功能用于弹出的电子邮件/电子邮件地址,不存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我做了一个小的应用程序,从web2py发送电子邮件,连接到gmail smtp服务器。这里的问题是它总是给我一个成功的信息!即使电子邮件地址无效。我已经通过将邮件从gmail发送到无效的电子邮件ID,测试了gmail的反弹功能,gmail说您的消息已发送,但是在发送的文件夹中给予邮件程序守护程序时间滞后(这对于不同的邮寄服务)。我认为web2py的mail.send()功能无法捕获,并将'您的消息发送'作为确认。如何捕获尚未使用web2py发送的邮件?如果mail.send(session.email,subject = session.subject,message = session.message),则

So I made a small app that sends emails from web2py, connected to the gmail smtp server. The problem here is that it always gives me a success message! Even when the email-id is invalid. I have tested the bounce back feature of gmail by sending mails from gmail to invalid email ids to which gmail says 'Your message has been sent', but on going to the sent folder gives the mailer daemon with a time lag(this differs for different mailing services). I think the mail.send() feature of web2py is unable to capture that and takes the 'Your message has been sent' as confirmation. How can one capture mails that haven't been sent using web2py?

if mail.send(session.email,subject=session.subject,message= session.message):
            response.flash = 'email sent sucessfully.'
else:
            response.flash = 'fail to send email sorry!'


推荐答案

mail.send()只是将消息传递给SMTP服务器,响应只是说服务器成功接收/接受消息进一步处理。要检查此操作是否断开计算机与网络的连接,或有意中断邮件配置,然后重试 - mail.send()应该失败,因为它无法连接到SMTP服务器来传递该邮件。

mail.send() is only passing the message to the SMTP server, the response simply states that the server successfully received/accepted the message for further processing. To check this disconnect your computer from the net or intentionally break the mail config and try again - mail.send() should fail since it can't connect to the SMTP server to hand it the message.

实际的消息处理(包括目标地址检查)会在SMTP服务器和邮件传递路径上的其他服务器之后发生。处理故障通常会导致错误的电子邮件发送(弹跳) - 这是电子邮件交换协议栈中与mail.send()运行的电子邮件交换协议栈不同的级别。

The actual message processing (including destination address check) happens later on the SMTP server and other servers on the mail delivery path. Processing failures typically cause error emails to be sent back (bouncing) - this is a different level in the email exchange protocol stack than the one at which mail.send() operates.

这篇关于web2py中的mail.send()功能用于弹出的电子邮件/电子邮件地址,不存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆