I have a GAE based app (python) and I'm trying to implement automatic email sending. When only one email is sent it works fine (both local and deployed). However, when I try to send two emails in a row the script only works on my local dev server. If the application is deployed to Google a strange mixup occurs. It seems like the body of the first email is sent to the recipient of the second one and then the application throws an internal server error.
Here's my code:
class MailSender(webapp.RequestHandler): def get(self): firstname=self.request.get('firstname') lastname=self.request.get('lastname') email=self.request.get('email') city=self.request.get('city') state=self.request.get('state') country=self.request.get('country') sender_address = firstname+" "+lastname+" <"+users.get_current_user().email()+">" subject = "Subject 1" body = "Name: "+firstname+"\nLast name: "+lastname+"\nEmail: "+email+"\nCity: "+city+"\nState: "+state+"\nCountry: "+country mail.send_mail(sender_address, "[email protected]", subject, body) sender_address1="[email protected]" subject1="Subject 2" body2="message" mail.send_mail(sender_address1, email, subject1, body1) self.response.out.write('{"status":"true"}')