Copy link to clipboard
Copied
I have a form which sends emails to various departments, but I am having problems getting the 'from' email address to show the email address entered in the email form field.
I have used the following code:-
<cfmail to="#form.options#" from="#form.email#" subject="A message has arrived from the **** website" username="***@gmail.com" password="****1" type="html">
Name: #form.name#
<br>Email: #form.email#
<br>Mobile: #form.mobile#
<br>Message: #form.message#
<br>Date: #form.datein#
</cfmail>
Is there something obvious I should change here?
Any help much appreciated.
haveringsfc wrote:
But the from email is variable dependent on the content entered into the email field on the form?
Yes, but the Gmail server is the sender. Remember that Gmail had the authority to change the value of the 'From' field.
Copy link to clipboard
Copied
Do you mean that the recipient(s) can see the 'from' e-mail address, but it is missing from the content of the e-mail message?
Copy link to clipboard
Copied
Hi - thank you for the response. The recipient can see the 'from' email address in the body of the text, but the 'from' email (ie. if you reply to the email) shows as the @gmail.com email that we are using whereas we would like this to show the 'from email as completed in the form' (I hope I have explained that properly).
Copy link to clipboard
Copied
Ah! What you observe has nothing to do with Coldfusion. It is a Gmail setting, which you can configure in your Gmail Account.
Copy link to clipboard
Copied
But the from email is variable dependent on the content entered into the email field on the form?
Copy link to clipboard
Copied
haveringsfc wrote:
But the from email is variable dependent on the content entered into the email field on the form?
Yes, but the Gmail server is the sender. Remember that Gmail had the authority to change the value of the 'From' field.
Copy link to clipboard
Copied
Any emails sent using gmail as the sender will change the from address to the gmail account. This is a gmail thing that you can't change. If this is an issue you may want to use another email service that will not do this.
Copy link to clipboard
Copied
Ah - thank you. Do you know an email service that will not do this?
Copy link to clipboard
Copied
Really no need for a third e-mail provider. Follow the link I gave above, and follow the instructions in the first option.
Assuming your 'From' e-mail is haveringsfc@someDomain.com, you can register the SMTP settings of someDomain.com in your Gmail account. That would enable you to use haveringsfc@someDomain.com as the 'From' e-mail address when sending an e-mail through the Gmail server by means of Coldfusion's cfmail tag.
Copy link to clipboard
Copied
@Haveringsfc
Any luck? I am curious to know how you got on. I am certain the Gmail connection makes it a topic others will also wish to know about.
Copy link to clipboard
Copied
@BKBK - sorry I have been side-tracked and not able to test this out yet. I will post here and let you know if it works (or not).
Many thanks for the input.
Copy link to clipboard
Copied
Just having had a quick read of the information on the link you provided, I am still not sure that this will solve my problem as it would appear at first glance that the 'from' email would be a set email address/domain rather than that of the person who has filled in the contact form?
The problem we have is that the form redirects the message to the relevant department (Selected by the person completing the contact form). When this email arrives at the department I am finding that they are replying to this message rather than sending a message to the email address provided by the person completing the form. This has meant that the gmail account used to send the form is receiving these replies rather than the person who completed the form.
I will try a bit later to read more into this and will respond again here with my findings.
Again many thanks.