I have set up an actionmailer for a basic contact form that send the email via my gmail address.
At the moment when I send an email, the from address, is my gmail address, whereas I would like it to be the email address entered into the contact form.
mail(to: "testemail@gmail.com", from: @email, subject: "Test Subject")
I couldn't find any answers for this, so how do I go about achieving this.
Thanks!
You cannot do that anymore. Unless the email address exists and is authorized to send email from gmail servers (credentials required) you will not be able to use random FROM
address.
Even if you are successful in sending an email like that from your own mail relay server, the email will almost always get marked as spam. There are several checks done on an email, such as:
Hence, it is not advisable to use a FROM
address entered on a web form. It will spoil the reputation of your IP address. That may result in your genuine emails also getting trapped by spam filters.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.