I have written a system that uses aws ses to send an email (code below). This works fine on the website, but I am also surprised that it seems to work from my local computer. What I am wondering is if I have accidentally given my aws account a global ability to send emails or is my local pc somehow logged into aws so that it can still send the email. If this is the case, how do I log out to make sure that it is secure ?, or how do I make sure that it is only the website that can send emails.
Thanks
Mark
# Form is valid, get the data from the form
sender_email = form.cleaned_data['form_email']
# Generate the new email message
strNewSubject = "CONTACT FROM sendemail DJANGO APP"
strNewMessage = f"Hello from a random user of sendemail Django App."
# Create a new SES resource and specify a region. SES is in
# eu-west-1 NOT eu-west-2
client = boto3.client('ses', region_name="eu-west-1")
tmpDestination = {'ToAddresses':
["blah@something.com", ], }
tmpMessage = {
'Body': {
'Text': {
'Charset': "UTF-8",
'Data': strNewMessage,
},
},
'Subject': {
'Charset': "UTF-8",
'Data': strNewSubject,
},
}
# Provide the contents of the email.
response = client.send_email(
Destination=tmpDestination,
Message=tmpMessage,
Source="srcaddress@gmail.com"
)
# Email sent and no error's
return True