Posted: April 8, 2014 at 1:35 am
|
Hello there, I Is that possible? I`m using EE 3.1.36.. I 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('event_espresso_send_email')) { if ($event_id == 14) { $headers = ""; if ($org_options['email_fancy_headers']=='Y') { $headers .= 'From: Someone <someone@somewhere.com>' . "\r\n"; $headers .= 'Reply-To: Someone <someone@somewhere.com>' . "\r\n"; } else { $headers .= 'From: <someone@somewhere.com>' . "\r\n"; $headers .= 'Reply-To: <someone@somewhere.com>' . "\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()</code> Thanks for any kind of help! Regards, RR |
|
Sorry, below the code again…: <pre class=”brush: php; gutter: true; first-line: 1; highlight: []; html-script: false”>//Email sender if ($event_id == 14) { else { function event_espresso_send_email($params) { if ($org_options['email_fancy_headers']=='Y') { 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); |
|
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); } |
|
Thanks, it seemed a bit of a long-shot 🙂 Well thanks for your reply. Regards |
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.