Python Webapp2 GAE email send issue

59 views Asked by At

I am working on a project in which I am sending an email to the user. In message body I am sending the custom message and it is working fine but when I add another variable for the link verification it did send the email but I do not receive it. But when I remove that link verification variable again it sends the email and I also receive it. Please help where I am doing mistake.

Here is the code which is working fine:

email = "[email protected]"
text = "from date: " + str(from_date) + " to date: " + str(to_date) + " Total Price: " + str(price)

message = mail.EmailMessage(
    sender="[email protected]",
    subject="Booking Confirmation"
)

message.to = email
message.body = """Dear """ + name + """:
               """"""
               Please note date and time
               """ + text + """.

               Please let us know if you have any questions.
               """
message.send()

Here is the code which is not working:

email = "[email protected]"
text = "from date: " + str(from_date) + " to date: " + str(to_date) + " Total Price: " + str(price)
link = "http://abc.appspot.com/place/confirm/?place_id=" 
message = mail.EmailMessage(
    sender="[email protected]",
    subject="Booking Confirmation"
)

message.to = email
message.body = """Dear """ + name + """:
               """+link+"""
               Please note date and time
               """ + text + """.

                Please let us know if you have any questions.
                """
message.send()
1

There are 1 answers

0
Dan Cornilescu On BEST ANSWER

It's not a mistake, the problem is including a link to an *.appspot.com domain, which, combined with being a new app (i.e. not yet trusted), triggers the now tighter Google infra anti-spam measures.

See GAE Issue 12786.

Contact the email address(es) mentioned in that thread if your app is not spamming, they probably have a hand-maintained whitelist for newer apps.