Ship your new yr greetings by e mail and textual content message utilizing Python

Technique 1. A tweak of the e-mail sending choice.

Technique 2. Ship by way of AWS

First, set up the AWS boto3 module.

Second, create an SNS consumer in Python.

import boto3
consumer = boto3.consumer(
aws_access_key_id="", # your aws entry key
aws_secret_access_key="", # your aws secrete entry key

Third, create a subject and add subscribers.

subject = consumer.create_topic(Identify="new_year") # create a subject
topic_arn = subject['TopicArn'] # get its Amazon Useful resource Identify
# Add SMS Subscribers to this subject
phone_numbers = ["+1234567890"]
for phone_number in phone_numbers:

Fourth, publish a message to the subject.

consumer.publish(Message="Glad New Yr!", TopicArn=topic_arn)

Technique three. Ship by way of Twilio

First, set up the Twilio module.

Second, create a Twilio consumer in Python

from twilio.relaxation import Shopperconsumer = Shopper(
"", # your Twilio Account SID
"", # your Twilio AUTH token

Third, create and ship message.

phone_numbers = ["+1234567890", "+1234567891"] # the listing of cellphone numbers to obtain the messagesfor phone_number in phone_numbers:
from_="", # your Twilio cellphone quantity
physique="Glad New Yr!"

Leave a Reply

Your email address will not be published. Required fields are marked *