Skip to main content
Participating Frequently
September 10, 2014
Answered

cfform to email - sending from email form field?

  • September 10, 2014
  • 2 replies
  • 945 views

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.

    This topic has been closed for replies.
    Correct answer BKBK

    But the from email is variable dependent on the content entered into the email field on the form? 


    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.

    2 replies

    Dave Ferguson
    Participating Frequently
    September 10, 2014

    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.

    Participating Frequently
    September 10, 2014

    Ah - thank you.  Do you know an email service that will not do this?

    BKBK
    Community Expert
    September 10, 2014

    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.

    BKBK
    Community Expert
    September 10, 2014

    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?

    Participating Frequently
    September 10, 2014

    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).

    BKBK
    Community Expert
    September 10, 2014

    Ah! What you observe has nothing to do with Coldfusion. It is a Gmail setting, which you can configure in your Gmail Account.