-
Notifications
You must be signed in to change notification settings - Fork 723
Send a Single Email to a Single Recipient #224
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@thinkingserious I would like to work on this issue. Can you give me some pointers , on how to proceed? |
Awesome! The first step will be to create a proposal similar to this so that the community can review and provide feedback. Thanks! Elmer |
@thinkingserious So, I just went through links for reference given in the issue description. But I still have some doubts. Thanks! Dibya |
Hi @dibyadas, Thank you for the follow up!
At a high level, we want a request object builder that we can pass to a function that will send the email. For the use case described in the example, I'm thinking of something along the lines of this (both cases should be possible): import sendgrid
sg = sendgrid.SendGridClient('SENDGRID_API_KEY')
from_email = Email('Test User', 'test@example.com')
to_email = Email('Test User', 'test@example.com')
subject = 'Hello World from the SendGrid Python Library!'
plain_text_content = 'Hello, Email!'
html_content = '<strong>Hello, Email!</strong>'
msg = create_single_email(from_email, to_email, subject, plain_text_content, html_content)
response = sg.send(msg) or import sendgrid
from sendgrid import SendGridMessage
sg = sendgrid.SendGridClient('SENDGRID_API_KEY')
msg = SendGridMessage()
msg.from_email = Email('Test User', 'test@example.com')
msg.to_email = Email('Test User', 'test@example.com')
msg.subject = 'Hello World from the SendGrid Python Library!'
msg.plain_text_content = 'Hello, Email!'
msg.html_content = '<strong>Hello, Email!</strong>'
response = sg.send(msg) The first case demonstrates the use of the SendGridMessage builder create_single_email which this issue addresses. The second case demonstrates the custom building of the SendGridMessage builder to allow for more advanced usage. |
@thinkingserious Thanks a lot for your informative explanation!
Here the SendGridResponse is the class that we going to add. And for the exception handling, we can also define SendGrid custom exceptions which can more be informative than standard python exceptions. Does this look good? Thanks! Regards, Dibya |
Looks good :) Thanks @dibyadas! |
@thinkingserious Once I am ready with proposed modifications, I will make a PR. 😄 Thanks! |
Awesome, thanks! |
@thinkingserious I was having some problems registering an account in SendGrid. It said that my profile has been flagged as high risk. 😕 Am I doing something wrong there? Thanks, Regards, Dibya |
What's your SendGrid username? |
@thinkingserious dibyadas |
@thinkingserious Thanks! I got a response from SendGrid support to activate my account. 😄 |
@thinkingserious Unfortunately, I did not get any reply from Bogdan from SendGrid support. But then I remembered, I have Github Student Pack. So I registered a free account in it and now its working. 😄 I cloned this repository and went through the code base. I saw that the response object returned here, for ex. , I also checked out this tree of the repo. It has a bit different code base. Am I missing something? Where should I make the changes? I installed the sendgrid module through pip. Sorry for the trouble! Thanks, |
Please branch off the current master (v4.1.0). That tree you are pointed to is no longer relevant. |
@thinkingserious I guess then the Response object of the email is sorted. I just need to add the single email sending feature like you mentioned and the exception handling. Thanks, |
Correct, thanks! |
This has been moved here. |
Hi @thinkingserious I am also facing the same issue, I just opened my new website as a Job portal & when I am registering it is not showing dashboard as it is saying that my profile is flagged as high risk, I don't why. Plz help. my registered email is admin@myjobpocket.com |
Acceptance Criteria:
Reference:
The text was updated successfully, but these errors were encountered: