load_phpmailer(); $mail = new EM_PHPMailer(); //$mail->SMTPDebug = true; if( get_option('dbem_smtp_html') ){ $mail->isHTML(); } $mail->ClearAllRecipients(); $mail->ClearAddresses(); $mail->ClearAttachments(); $mail->CharSet = 'utf-8'; $mail->SetLanguage('en', dirname(__FILE__).'/'); $mail->PluginDir = dirname(__FILE__).'/phpmailer/'; $mail->Host = get_option('dbem_smtp_host'); $mail->port = get_option('dbem_rsvp_mail_port'); $mail->Username = get_option('dbem_smtp_username'); $mail->Password = get_option('dbem_smtp_password'); $mail->From = get_option('dbem_mail_sender_address'); $mail->FromName = get_option('dbem_mail_sender_name'); // This is the from name in the email, you can put anything you like here $mail->Body = $body; $mail->Subject = $subject; if(is_array($receiver)){ foreach($receiver as $receiver_email){ $mail->AddAddress($receiver_email); } }else{ $mail->AddAddress($receiver); } //Protocols if ( get_option('dbem_rsvp_mail_send_method') == 'wp_mail' ){ $mail->Mailer = 'wp_mail'; $send = wp_mail($receiver, $subject, $body); if(!$send){ global $phpmailer; $this->errors[] = $phpmailer->ErrorInfo; } }else{ if( get_option('dbem_rsvp_mail_send_method') == 'qmail' ){ $mail->IsQmail(); }else { $mail->Mailer = get_option('dbem_rsvp_mail_send_method'); } if(get_option('dbem_rsvp_mail_SMTPAuth') == '1'){ $mail->SMTPAuth = TRUE; } $send = $mail->Send(); if(!$send){ $this->errors[] = $mail->ErrorInfo; } } return $send; }else{ $this->errors = __('Please supply a valid email format.', 'dbem'); return false; } } /** * load phpmailer classes */ function load_phpmailer(){ require_once(dirname(__FILE__) . '/phpmailer/class.phpmailer.php'); require_once(dirname(__FILE__) . '/phpmailer/class.smtp.php'); } } ?>