Step 1:Login to Azure Portal, Search “SendGrid Service"
Step 2:Create Twilio SendGrid Service,Select “Free 100″.(100 emails/day forever)
Select Subscription > Resource group > Input Name
Create Success
Step 3: Open SaaS Account on publisher’s site,You can see a Dashboard.
Step 4: Sender Authentication
Settings > Sender Authentication > Authenticate Your Domain
Select Your Domain Host
Domain Verified Success!
Step 5: Then, Create a sender identity
Mail Settings > Sender Authentication > Create New Sender
Fill out the Sender Information
Step 6: Create API Key
Settings > API Keys > Create API Key
The API Key is shown only once. Make sure to save this token information.
Now, You can send an email by using SendGrid Service.
Step 7:Send Email by using Python Example
# using SendGrid's Python Library# https://github.com/sendgrid/sendgrid-python
from sendgrid import SendGridAPIClient
from sendgrid.helpers.mail import Mail
message = Mail(
from_email='test@xx.xxxxx.com',
to_emails='xxxxxxxx@xxxxx.xxxxx',
subject='Sending with Twilio SendGrid is Fun',
html_content='<strong>and easy to do anywhere, even with Python</strong>')
try:
sg = SendGridAPIClient('SG.9nS5FGIXRWyfCEtQ4zgVEA.xxxxxxxxxx')
response = sg.send(message)
print(response.status_code)
print(response.body)
print(response.headers)
except Exception as e:
print(e)
發表留言