Question

I've been trying to create a contact page on my website that will send the email using the Google SMTP I can manage to do that. I am able to send a message confirming that the we have received the message. I would like to send a message to the email I use to say someone has used sent a message, but I can only get it to send as myself to myself, I would really prefer it to come up as the users email in the sender field rather than my email so I can just click reply to send them a message back. Is this possible. Thanks for the help in advance

#kvEmail is my email and senderEmail is the users email
#this is the email sending to the user
s.sendmail(kvEmail, senderEmail, confirmMSG.as_string())
#this is the email sent to my self
s.sendmail(senderEmail, kvEmail, adminMSG.as_string())
Was it helpful?

Solution

Gmail isn't going to let you spoof the sender, which is what you're trying to do. Spammers and scammers do that. Does your Web host have an SMTP server? Try that.

An alternative approach might be to put the user's address it the Reply-To header. It'll appear to come from you, but when you reply it'll at least go to the original user. GMail might be OK with that.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top