Closed niss3n closed 3 years ago
Hey would It be cool for me to solve this issue?
just a heads up that Python3 breaks backwards compatibility. Sendgrid requires Python 2.6, 2.7, 3.4 or 3.5. we can roll back to python 3.5. Its your choice!
If youre open to the idea of other ways of sending email's. I have created a simple solution to your problem using smtplib which is downloaded by default on all macs, however, It comes with configuration variables that must be configured. https://www.afternerd.com/blog/how-to-send-an-email-using-python-and-smtplib/
Hey Paul!
The nice thing about using SendGrid is that it uses Microsoft's SMPT server and we can authenticate using an API Key vs a username and password. Plus you can have it come from any email address you want. I currently have this working using python 3.8 (might be a recent feature though?) in a different project. Here is an example of that:
import os from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail
def SendGridEmail(): print("sending email") message = Mail( from_name ='John Doe', from_email='fromme@fromme.com', to_emails='tome@tome.com', subject='This is my Subject!', html_content='')
token = "#{SendGridApiKey}#" # This will not change, the pipeline uses
token replacement to get the variable. sg = SendGridAPIClient(token) resonse = sg.send(message)
Let me know if you have any questions!
-Brad
On Thu, Oct 22, 2020 at 2:42 AM Paul Sin notifications@github.com wrote:
If youre open to the idea of other ways of sending email's. I have created a simple solution to your problem using smtplib which is downloaded by default on all macs, however, It comes with configuration variables that must be configured.
https://www.afternerd.com/blog/how-to-send-an-email-using-python-and-smtplib/
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/niss3n/webscraper/issues/4#issuecomment-714369982, or unsubscribe https://github.com/notifications/unsubscribe-auth/AF7S4BK7K2MJTG4WXQJ4XPLSL747XANCNFSM4SUXX7UQ .
Would it be okay if I got this task assigned?
Hey niss3n, I too got sendgrid working on my python. even though it says that on their main page. Someone should change that documentation. I noticed my main problem was the google security.
This setting kept denying my log in attempt.
I have just created a pull request regarding sendgrid. Everything works locally, however, when others or yourself use it you might have to sign up for a sendgrid account and use your own API key.
Sendgrid has been integrated and the Issue has been closed.
docs: https://docs.microsoft.com/en-us/azure/sendgrid-dotnet-how-to-send-email
The API Key is already in key vault.