I have a web application in Python that allows someone to post a message. When this occurs, my application will automatically dispatch an email to the other user, who is following the "conversation/post". The user receive the email and replies with a message such as "Ok".
I want capture this reply message to a post in my application. I see this in applications such as Assana. How I can do this? Does there exists a service or API I can use?
Any email sent from the user will go to the domain mail server. If you want to receive it in a POST request, you'll have to write a separate application that retrieves email messages from the mail server and then sends the ones you want in a HTTP request to your web server. You'll then have to run your application as a daemon/service, and have it periodically poll the server for new messages (or use IMAP IDLE)
You may want to use imaplib to retrieve the emails.
Developing a complete two-way bridge between a web page and email with conversation tracking will likely require knowledge about MTA and LDA administration
Related
Our Flask application currently supports sending emails via SMTP (using Python's smtplib library), but the sender email available to us has 2FA enabled and app password disabled.
Given that we cannot use app passwords and 2FA is enabled, is it possible to send via SMTP or is there any other way of sending emails from this particular account using any service that works with 2FA?
When we try sending via SMTP using username/password, we get below error:
smtplib.SMTPAuthenticationError: (535, b'5.7.139 Authentication unsuccessful, the request did not meet the criteria to be authenticated successfully. Contact your administrator. [PN3PR01CA0027.INDPRD01.PROD.OUTLOOK.COM]')
I have made a website , and there are users in it who can send and receive messages to each other, i need to develop a mechanism in which when message is send to a user & if user is login it shows him a message that you have received a message without refreshing the page or fetching from database if message received . just like it is working in facebook and many other sites actually i want to make a chat between 2 users.
I'm learning to use suds in a python script to send SQL queries to a database. I'd like to able to send myself an email when the query job is finished (it has a job ID so I'm able to check its status). How do I do that?
This is how you send an email via python just fill in the blanks and input it to your code:
import smtplib
content = ("Content to send")
mail = smtplib.SMTP('smtp.gmail.com',587)
mail.ehlo()
mail.starttls()
mail.login('your_email#gmail.com','123your_password')
mail.sendmail('your_email#gmail.com','destination_email#gmail.com',content)
mail.close()
print("Sent")
(you dont have to use gmail as most addresses will still work through the gmail smtp)
If email is not required, you can also send chat messages to yourself.
Two projects achieving this :
Nimrod, for Facebook Messenger : https://www.nimrod-messenger.io/
Telegram Middleman, for Telegram : https://github.com/n1try/telegram-middleman-bot
I just wrote a Python decorator for this purpose. You can realize it in one line.
https://github.com/Wenzhi-Ding/py_reminder
from py_reminder import monitor
#monitor('SQL Query of xxx')
def query(sql):
...send your query...
query()
Once this function finishes / or is caught an error, you will get an email notification with some brief information.
I'm trying to use google app engine's mail service on my site. It's showing some error whenever I visit the page that sends the email. The error says that I am using an unauthorized sender for the message. Here's the code that sends the email:
mail.send_mail(sender="myapp#appspot.gserviceaccount.com",
to=input_dict["email"],
subject="Mondays user activation",
body=content)
When I try out the site locally (using dev_appserver.py) it doesn't show the error, but it doesn't send the email (Note: I have to add the --enable_sendmail option when I try it locally). The error only shows up when I publish the site.
Does anybody know what I'm doing wrong? Thanks in advance for your help!
What is myapp#appspot.gserviceaccount.com? You might not be able to send mail from that address.
App Engine applications can send email messages on behalf of the app's
administrators, and on behalf of users with Google Accounts.
The email address of the sender, the From address. The sender address
must be one of the following types:
The address of a registered administrator for the application. You can add administrators to an application using the Administration
Console.
The address of the user for the current request signed in with a Google Account. You can determine the current user's email address
with the Users API. The user's account must be a Gmail account, or be
on a domain managed by Google Apps.
Any valid email receiving address for the app (such as xxx#APP-ID.appspotmail.com).
Any valid email receiving address of a domain account, such as support#example.com. Domain accounts are accounts outside of the
Google domain with email addresses that do not end in #gmail.com or
#APP-ID.appspotmail.com.
https://developers.google.com/appengine/docs/python/mail/sendingmail
First follow these steps
https://cloud.google.com/appengine/docs/python/mail/#who_can_send_mail
Then you need to manually add the sender email in cloud console
How to add an authorized sender
You may also have to add the email address you which to send the email from to the App Engine application settings Email API authorized senders.
See https://cloud.google.com/appengine/docs/python/mail/#Python_Sending_mail
Add the unauthorized email address as an administrator here:
https://console.developers.google.com/project/_/permissions/projectpermissions
I have successfully sent an email using the Google App Engine. However the only email address I can get to work is the gmail address I have listed as the admin of the site. I'm running the app on my own domain (bought and maintained using Google Apps). I would like to send the email from my own domain. Here's the code (or something similar to it):
from google.appengine.api import mail
sender = "myaddress#google.com"
sender_i_want = "myaddress#mygoogleapp.com"
mail.send_mail(sender=sender,
to="Albert Johnson <Albert.Johnson#example.com>",
subject="Your account has been approved",
body=some_string_variable)
And the error I get when I try to send it from my own domain is "InvalidSenderError: Unauthorized sender". I own the domain, I do in fact authorize using my domain to send the mail, I just need to know how to convince the App Engine that this is true.
That's a restriction of App Engine's mail API:
The sender address can be either the email address of a registered administrator for the application, or the email address of the current signed-in user (the user making the request that is sending the message).
If you've got Google Apps running on that domain, you should have (or be able to create) an #thatdomain.com email addresses that you can register as an administrator of the App Engine app in question, which will then let you send email "from" that address.