Title: Custom Activation Email
Last modified: August 30, 2016

---

# Custom Activation Email

 *  Resolved [eupalinos](https://wordpress.org/support/users/eupalinos/)
 * (@eupalinos)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-activation-email-1/)
 * Hi, Alo.
 * I’m trying to create a mu-plugin to send a custom activation email based on a“
   activation.php” (html + images) file, but of course it doesn’t work. Do you have
   any idea why? I copied the entire section from the alo-easymail-mailer.php file
   and edited it to no avail.
 *     ```
       <?php
   
       function alo_em_handle_custom_activation_email ( $args ) {
       	// $args['to'], $args['subject'], $args['message'], $args['headers'], $args['attachments']
   
       	// Check based on $args['subject']; more attrs in $args['message']
       	global $_config;
       	/*
       	 * 1) Activation e-mail
       	 */
       	if ( strpos ( "#_EASYMAIL_ACTIVATION_#", $args['subject'] ) !== false) {
   
       		// Get the parameters stored as a query in $args['message']
       		$defaults = array( 'lang' => '', 'email' => '',	'name' => '', 'unikey' => '' );
       		/* // replaced 'wp_parse_args' because use urlencode and stripslashes, so affect emails with '+' chars
       		$customs = wp_parse_args( $args['message'], $defaults );
       		extract( $customs, EXTR_SKIP );
       		*/
       		$pars = array();
       		$raw = explode('&', $args['message']);
       		foreach ($raw as $section)
       		{
       			if (strpos($section, '=') !== false)
       			{
       				list($key, $value) = explode('=', $section);
       				$pars[$key] = $value;
       			}
       		}
       		$customs = array_merge( $defaults, $pars );
       		extract( $customs, EXTR_SKIP );
   
       		// Subject
       		if ( $subject_text = alo_em_translate_option ( $lang, 'alo_em_txtpre_activationmail_subj', true ) ) {
       			$subject = $subject_text;
       		} else {
       			$subject = alo_em___( __("This is a custom activation email", "alo-easymail" ) );
       		}
       		$args['subject'] = $subject;
   
       		// Content
       		if ( $content_txt = alo_em_translate_option ( $lang, 'alo_em_txtpre_activationmail_mail', true ) ) {
       			$content = $content_txt;
       		} else {
       		$content = file_get_contents(WP_CONTENT_DIR . '/uploads/activation.php');
       		}
   
       		$sub_vars = $email ."|" /*$div_email[0] . "|" . $div_email[1] . "|" */ . $unikey . "|" . $lang;
   
       		//$sub_vars = $subscriber->ID . "|" . $subscriber->unikey;
       		$sub_vars = urlencode( base64_encode( $sub_vars ) );
       		$sub_link = add_query_arg( 'emact', $sub_vars, alo_em_translate_home_url ( $lang ) );
   
       		$content = str_replace ( "%ACTIVATIONLINK%", $sub_link, $content );
   
       		$args['message'] = $content;
       	}
       	return $args;
       }
   
       add_filter('wp_mail', 'alo_em_handle_custom_activation_email');
       ?>
       ```
   
 * Thank you.

Viewing 1 replies (of 1 total)

 *  Thread Starter [eupalinos](https://wordpress.org/support/users/eupalinos/)
 * (@eupalinos)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/custom-activation-email-1/#post-6627107)
 * I only had to tweak the chunk above some more, and now it works. I can send a
   custom activation email as a complete html file.
 * You can mark this thread as solved, too.
 * Thank you.
 * Marco.

Viewing 1 replies (of 1 total)

The topic ‘Custom Activation Email’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/alo-easymail_574f4b.svg)
 * [ALO EasyMail Newsletter](https://wordpress.org/plugins/alo-easymail/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/alo-easymail/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/alo-easymail/)
 * [Active Topics](https://wordpress.org/support/plugin/alo-easymail/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/alo-easymail/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/alo-easymail/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [eupalinos](https://wordpress.org/support/users/eupalinos/)
 * Last activity: [10 years, 7 months ago](https://wordpress.org/support/topic/custom-activation-email-1/#post-6627107)
 * Status: resolved