Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-sales domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the better-click-to-tweet domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-amazon domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the pue-stats domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/staging-poc/public_html/wp-includes/functions.php on line 6114
Change registration confirmation e-mail headers per event | Event Espresso - Staging Server

Support

Home Forums Event Espresso Premium Change registration confirmation e-mail headers per event

Change registration confirmation e-mail headers per event

Posted: April 8, 2014 at 1:35 am

Viewing 3 reply threads


paradigma

April 8, 2014 at 1:35 am

Hello there,

Im currently struggling with changing registration confirmation e-mail headers for one event only. Im trying to change e-mail headers such as From E-mail, From Name and Reply-To for one event specific upon my clients request.

Is that possible? I`m using EE 3.1.36..

Ive tried editing "uploads/espresso/custom_functions.php" with code below, but doesnt seem to work..

For the note, I`m not too fond of php, but i think you can see what I was up to.

<code>
//Email sender
if (!function_exists(&#039;event_espresso_send_email&#039;)) {

	if ($event_id == 14) {
			$headers = &quot;&quot;;
				if ($org_options[&#039;email_fancy_headers&#039;]==&#039;Y&#039;) {
					$headers .= &#039;From: Someone &lt;someone@somewhere.com&gt;&#039; . &quot;\r\n&quot;;
					$headers .= &#039;Reply-To: Someone &lt;someone@somewhere.com&gt;&#039; . &quot;\r\n&quot;;
				} 
				else {
					$headers .= &#039;From: &lt;someone@somewhere.com&gt;&#039; . &quot;\r\n&quot;;
					$headers .= &#039;Reply-To: &lt;someone@somewhere.com&gt;&#039; . &quot;\r\n&quot;;
				}}

	else {

	function event_espresso_send_email($params) {
		global $org_options;
		do_action(&#039;action_hook_espresso_log&#039;, __FILE__, __FUNCTION__, &#039;&#039;);
		extract($params);
		//Define email headers
		$headers = &quot;&quot;;
		
		if ($org_options[&#039;email_fancy_headers&#039;]==&#039;Y&#039;) {
			$headers .= &quot;From: &quot; . $org_options[&#039;organization&#039;] . &quot; &lt;&quot; . $org_options[&#039;contact_email&#039;] . &quot;&gt;\r\n&quot;;
			$headers .= &quot;Reply-To: &quot; . $org_options[&#039;organization&#039;] . &quot;  &lt;&quot; . $org_options[&#039;contact_email&#039;] . &quot;&gt;\r\n&quot;;
		} 
		else {
			$headers .= &quot;From: &quot; . $org_options[&#039;contact_email&#039;] . &quot;\r\n&quot;;
			$headers .= &quot;Reply-To: &quot; . $org_options[&#039;contact_email&#039;] . &quot;\r\n&quot;;
		}
		$headers .= &quot;Content-Type: text/html; charset=utf-8\r\n&quot;;
		//Debug
//		 echo &#039;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&#039;;
//		  echo &#039;&lt;p&gt;$headers = &#039;.$headers.&#039;&lt;/p&gt;&#039;;
//		  echo &#039;&lt;p&gt;$send_to = &#039;.$send_to.&#039;&lt;/p&gt;&#039;;
//		  echo &#039;&lt;p&gt;$email_subject = &#039;.$email_subject.&#039;&lt;/p&gt;&#039;;
//		  echo &#039;&lt;p&gt;$email_body = &#039;.$email_body.&#039;&lt;/p&gt;&#039;;
//		  echo &#039;&lt;p&gt;&#039;.$email_body.&#039;&lt;/p&gt;&#039;;
//		 echo &#039;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&lt;br/&gt;&#039;;

		return wp_mail($send_to, stripslashes_deep(html_entity_decode($email_subject, ENT_QUOTES, &quot;UTF-8&quot;)), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, &quot;UTF-8&quot;)), $headers);
	}
}
}//End event_espresso_send_email()</code>

Thanks for any kind of help!

Regards, RR


paradigma

April 8, 2014 at 2:11 am

Sorry, below the code again…:

<pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>//Email sender
if (!function_exists('event_espresso_send_email')) {

if ($event_id == 14) {
$headers = "";
if ($org_options['email_fancy_headers']=='Y') {
$headers .= 'From: Datalab <dlacademy@datalab.si>' . "\r\n";
$headers .= 'Reply-To: Datalab <dlacademy@datalab.si>' . "\r\n";
}
else {
$headers .= 'From: <dlacademy@datalab.si>' . "\r\n";
$headers .= 'Reply-To: <dlacademy@datalab.si>' . "\r\n";
}}

else {

function event_espresso_send_email($params) {
global $org_options;
do_action('action_hook_espresso_log', __FILE__, __FUNCTION__, '');
extract($params);
//Define email headers
$headers = "";

if ($org_options['email_fancy_headers']=='Y') {
$headers .= "From: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
$headers .= "Reply-To: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
}
else {
$headers .= "From: " . $org_options['contact_email'] . "\r\n";
$headers .= "Reply-To: " . $org_options['contact_email'] . "\r\n";
}
$headers .= "Content-Type: text/html; charset=utf-8\r\n";
//Debug
// echo '<br/><br/><br/><br/>';
// echo '<p>$headers = '.$headers.'</p>';
// echo '<p>$send_to = '.$send_to.'</p>';
// echo '<p>$email_subject = '.$email_subject.'</p>';
// echo '<p>$email_body = '.$email_body.'</p>';
// echo '<p>'.$email_body.'</p>';
// echo '<br/><br/><br/><br/>';

return wp_mail($send_to, stripslashes_deep(html_entity_decode($email_subject, ENT_QUOTES, "UTF-8")), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, "UTF-8")), $headers);
}
}
}//End event_espresso_send_email()


Dean

  • Support Staff

April 8, 2014 at 5:07 am

Hi,

I haven’t tested this, but your function was pretty broken, so I’ve just fixed it a bit.

However, it will not work. The problem you have is that that function does not have access to the event ID, so your if/else statement will return false every time.

I couldn’t see offhand where you could even get that information from at that point barring, maybe, doing a database call. I certainly couldn’t see how that would work either.

You may even need to edit core files (and I do not say that lightly, nor recommend it) to achieve your goal.

		function event_espresso_send_email($params) {

		if ($event_id == 1) {
				$headers = "";
				if ($org_options['email_fancy_headers']=='Y') {
				$headers .= 'From: Datalab <dlacademy@datalab.si>' . "\r\n";
				$headers .= 'Reply-To: Datalab <dlacademy@datalab.si>' . "\r\n";
				}
				else {
				$headers .= 'From: <dlacademy@datalab.si>' . "\r\n";
				$headers .= 'Reply-To: <dlacademy@datalab.si>' . "\r\n";
				}
		}
		else {
			

			//Define email headers
			$headers = "";
			if ($org_options['email_fancy_headers']=='Y') {
			$headers .= "From: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
			$headers .= "Reply-To: " . $org_options['organization'] . " <" . $org_options['contact_email'] . ">\r\n";
			}
			else {
			$headers .= "From: " . $org_options['contact_email'] . "\r\n";
			$headers .= "Reply-To: " . $org_options['contact_email'] . "\r\n";
			}

		}

		$headers .= "Content-Type: text/html; charset=utf-8\r\n";
		//Debug
		//	 echo '<br/><br/><br/><br/>';
		//	 echo '<p>$headers = '.$headers.'</p>';
		//	 echo '<p>$send_to = '.$send_to.'</p>';
		//	 echo '<p>$email_subject = '.$email_subject.'</p>';
		//	 echo '<p>$email_body = '.$email_body.'</p>';
		//	 echo '<p>'.$email_body.'</p>';
		//	 echo '<br/><br/><br/><br/>';
		return wp_mail($send_to, stripslashes_deep(html_entity_decode($email_subject, ENT_QUOTES, "UTF-8")), stripslashes_deep(html_entity_decode(wpautop($email_body), ENT_QUOTES, "UTF-8")), $headers);


	}


paradigma

April 8, 2014 at 6:31 am

Thanks, it seemed a bit of a long-shot :)

Well thanks for your reply.

Regards

Viewing 3 reply threads

The support post ‘Change registration confirmation e-mail headers per event’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso - Staging Server