<p>I've used JS to copy the form input content into hidden fields that gets added to the message in this way...</p>

<pre><code>&lt;input id="fromName" type="text" name="fromName" value="{% if message is defined %}{{ message.fromName }}{% endif %}"&gt;
&lt;input type="hidden" id="fullName" name="message[Full Name]" class="fullName"&gt;

&lt;input id="fromEmail" type="email" name="fromEmail" value="{% if message is defined %}{{ message.fromEmail }}{% endif %}"&gt;
&lt;input type="hidden" id="emailAddress" name="message[Email Address]" class="emailAddress"&gt;

&lt;input type="hidden" id="currentDate" name="message[Date Submitted]" class="currentDate" value="{{ now|date("F j, Y - g:i a") }}"&gt;
</code></pre>

<p>Then I add something like this on submit:</p>

<pre><code>$('#fromName').bind('keypress keyup blur', function() {
  $('#fullName').val($(this).val());
});
</code></pre>

<p>To get the info copied to the corresponding fields. This helps me get a nice emailed message with all the data I want:</p>

<p><em>Full Name: jane Doe<br>
Email Address: jane@gmail.com<br>
Phone: 5551234567<br>
Message: TESTING ONLY<br>
Date Submitted: December 17, 2015 - 12:02 pm</em>                       </p>

<p>This solution gets the info needed into the notification, but doesn't help with headers.</p>

CC BY-SA 3.0
2016-01-28T03:56:32.233Z
2016-01-28T03:56:32.233Z
Danielle LeComte
<p>Not without hacking (boo!) or forking (yay!) the plugin.</p>

<p>Currently, the fromEmail is being <a href="https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L41" rel="nofollow">set</a> from the email address set in the plugin's setting.</p>

<pre><code>$email-&gt;fromEmail = $emailSettings['emailAddress'];
</code></pre>

<p>And the replyTo is being <a href="https://github.com/pixelandtonic/ContactForm/blob/master/contactform/services/ContactFormService.php#L42" rel="nofollow">set</a> to the email that was supplied on the front-end contact form.</p>

<pre><code>$email-&gt;replyTo   = $message-&gt;fromEmail;
</code></pre>

<p>This is done because some email servers will see that the <code>from</code> address is different than the domain the email originated on and wrongly mark it as SPAM.</p>

<p>You'd adjust those however you need.</p>

<p>If you want to output the email in the message body, you'd just need to add it to the <code>$message-&gt;message</code> property in the <a href="https://github.com/pixelandtonic/ContactForm/blob/master/contactform/controllers/ContactFormController.php" rel="nofollow">controller</a>.</p>

<p>Alternatively, you can use a more <a href="http://sprout.barrelstrengthdesign.com/craft-plugins/forms" rel="nofollow">robust form building solution</a>. </p>

CC BY-SA 3.0
2014-12-11T20:50:06.997Z
2016-01-27T23:50:56.690Z
2016-01-27T23:50:56.690Z
Brad Bell
<p>I'm generally including the email in the message body in every project by tweaking the plugin like so...</p>

<p>Open controllers/ContactFormController.php and look for:</p>

<pre><code>$compiledMessage = '';
</code></pre>

<p>and then, below it, add something like this:</p>

<pre><code>$compiledMessage .= "Please reply to: ";
$compiledMessage .= $message-&gt;fromEmail;
$compiledMessage .= "\n\n";
</code></pre>

CC BY-SA 3.0
2014-12-12T13:46:27.167Z
2014-12-12T13:46:27.167Z
Clive Portman
<p>So I have a contact form set up in Craft using the Contact Form plugin. I have it rigged up with Mandrill as the SMTP provider and unfortunately with the notifications, the from email address is getting stripped out of the headers by Mandrill. So there's no way to determine who the email came from in order to reply to that person.</p>

<p>So my question is - is there a way to set the replyto to the fromEmail OR is there a way to output the from: email address in the resulting notification message?</p>

<p>Many thanks in advance from me and the client dealing with it!</p>

<p>Cheers,
J</p>

<form>
Contact Form - ReplyTo or Output fromEmail
# Contact Form - ReplyTo or Output fromEmail

(Asked by: username_0 on 2014-12-11)

So I have a contact form set up in Craft using the Contact Form plugin. I have it rigged up with Mandrill as the SMTP provider and unfortunately with the notifications, the from email address is getting stripped out of the headers by Mandrill. So there's no way to determine who the email came from in order to reply to that person.

So my question is - is there a way to set the replyto to the fromEmail OR is there a way to output the from: email address in the resulting notification message?

Many thanks in advance from me and the client dealing with it!

Cheers,
J

**Tags:** form


---

## 3 answers

### Answer by username_1 on 2016-01-28. Score: 2

I've used JS to copy the form input content into hidden fields that gets added to the message in this way...








Then I add something like this on submit:
$('#fromName').bind('keypress keyup blur', function() {
  $('#fullName').val($(this).val());
});

To get the info copied to the corresponding fields. This helps me get a nice emailed message with all the data I want:
Full Name: jane Doe
Email Address: jane@gmail.com
Phone: 5551234567
Message: TESTING ONLY
Date Submitted: December 17, 2015 - 12:02 pm 
This solution gets the info needed into the notification, but doesn't help with headers.


---

### Answer by username_2 on 2014-12-11. Score: 2

Not without hacking (boo!) or forking (yay!) the plugin.
Currently, the fromEmail is being set from the email address set in the plugin's setting.
$email->fromEmail = $emailSettings['emailAddress'];

And the replyTo is being set to the email that was supplied on the front-end contact form.
$email->replyTo   = $message->fromEmail;

This is done because some email servers will see that the from address is different than the domain the email originated on and wrongly mark it as SPAM.
You'd adjust those however you need.
If you want to output the email in the message body, you'd just need to add it to the $message->message property in the controller.
Alternatively, you can use a more robust form building solution.


---

### Answer by username_3 on 2014-12-12. Score: 1

I'm generally including the email in the message body in every project by tweaking the plugin like so...
Open controllers/ContactFormController.php and look for:
$compiledMessage = '';

and then, below it, add something like this:
$compiledMessage .= "Please reply to: ";
$compiledMessage .= $message->fromEmail;
$compiledMessage .= "\n\n";


---

