When a user sends some enquiry through a company’s website, he also enters email,
now is there a way where the email when received to the enquiry department will reflect as :
From : user@xyz.com
Subject: enquiry
Some Text
where “user@xyz.com” is the email entered by user in the enquiry form.
the same can be seen in some e-card website, where you send ecard to your friends email and they receive it with your address in the “from” part.
how can this be achieved?
————EDIT————-
Example:
Front-End :
To send ecard to your friend:
your email address : abc@xyz.com
your friends email address: lmn@pqr.com
and then friend receives an email as:
from: abc@xyz.com via jkh.hk.dn.net
to: lmn@pqr.com
subject: ecard
ecard email
as you can see though the email is send the e-card website, the from address reflect the email address entered by user.
So need some help on how this can be achieved? and any example would be more helpful…
You might have more success using the “reply-to” and “sender” fields, which can be different to the from address, and most mail clients should honour – and has less “spammy” connotations:
So your form has:
Then when you generate the email you send it as:
This way the receiving mail server can see you’re being honest about where the email is coming from, and if they check any SPF records for the
fromdomain they should match with your server. However when the user hits “Reply” the email should go to the Reply-to address instead.If you really want to set the user’s email as the
fromfield then you should set the system email address as thesender:This will result in the email appearing as “From website@example.com on behalf of user@abc.com“.
See also the following Stack Overflow question: