public function execute() { include_once rex_path::addon('import_export', 'functions/function_import_export.php'); include_once rex_path::addon('import_export', 'functions/function_import_folder.php'); $filename = $this->getParam('filename', self::DEFAULT_FILENAME); $filename = str_replace('%REX_SERVER', parse_url(rex::getServer(), PHP_URL_HOST), $filename); $filename = str_replace('%REX_VERSION', rex::getVersion(), $filename); $filename = strftime($filename); $file = $filename; $dir = getImportDir() . '/'; $ext = '.sql'; if (file_exists($dir . $file . $ext)) { $i = 1; while (file_exists($dir . $file . '_' . $i . $ext)) { ++$i; } $file = $file . '_' . $i; } if (rex_a1_export_db($dir . $file . $ext)) { $message = $file . $ext . ' created'; if ($this->sendmail) { if (!rex_addon::get('phpmailer')->isAvailable()) { $this->setMessage($message . ', mail not sent (addon "phpmailer" isn\'t activated)'); return false; } $mail = new rex_mailer(); $mail->AddAddress($this->mailaddress); $mail->Subject = rex_i18n::msg('im_export_mail_subject'); $mail->Body = rex_i18n::msg('im_export_mail_body', rex::getServerName()); $mail->AddAttachment($dir . $file . $ext, $filename . $ext); if ($mail->Send()) { $this->setMessage($message . ', mail sent'); return true; } $this->setMessage($message . ', mail not sent'); return false; } $this->setMessage($message); return true; } $this->setMessage($file . $ext . ' not created'); return false; }
function sendMail($template) { $mail = new rex_mailer(); $mail->AddAddress($template["mail_to"], $template["mail_to_name"]); $mail->SetFrom($template["mail_from"], $template["mail_from_name"]); $mail->Subject = $template["subject"]; $mail->Body = $template["body"]; if ($template["body_html"] != "") { $mail->AltBody = $template["body"]; $mail->MsgHTML($template["body_html"]); } else { $mail->Body = strip_tags($template["body"]); } if (is_array($template["attachments"])) { foreach ($template["attachments"] as $f) { $mail->AddAttachment($f["path"], $f["name"]); } } return $mail->Send(); }
static function sendMail($template, $template_name = '') { $r = rex_register_extension_point('XFORM_EMAIL_BEFORE_SEND', array('template' => $template, 'template_name' => $template_name, 'status' => false)); $template = $r['template']; $template_name = $r['template_name']; $status = $r['status']; if ($status) { return true; } $mail = new rex_mailer(); $mail->AddAddress($template['mail_to'], $template['mail_to_name']); $mail->SetFrom($template['mail_from'], $template['mail_from_name']); $mail->Subject = $template['subject']; $mail->Body = $template['body']; if ($template['body_html'] != '') { $mail->AltBody = $template['body']; $mail->MsgHTML($template['body_html']); } else { $mail->Body = strip_tags($template['body']); } if (is_array($template['attachments'])) { foreach ($template['attachments'] as $f) { $mail->AddAttachment($f['path'], $f['name']); } } if ($mail->Send()) { $template['email_subject'] = $template['subject']; rex_register_extension_point('XFORM_EMAIL_SENT', $template_name, $template, true); // read only return true; } else { $template['email_subject'] = $template['subject']; rex_register_extension_point('XFORM_EMAIL_SENT_FAILED', $template_name, $template, true); // read only return false; } }
$from = "REX_VALUE[2]"; $FromName = "REX_VALUE[8]"; $rsubject = "REX_VALUE[17]"; // SENDEN $mail = new rex_mailer(); #$mail->Body = $Body; #$mail->AltBody = nl2br($responsemail); $mail->AddAddress($To); $mail->FromName = $FromName; $mail->From = $from; $mail->Sender = $from; //Absenderadresse als Return-Path $mail->Subject = $rsubject; $mail->Priority = null; if ("REX_MEDIA[id=1 output=1]" != '') { $mail->AddAttachment($form_attachment); } if ($form_deliver_org != 'ja') { $mail->Body = $responsemail . $nonhtmlfooter; } else { if ("REX_VALUE[12]" == 'ja') { $mail->IsHTML(true); $mail->Body = $form_template_html . nl2br($responsemail) . '<hr/>' . nl2br($rmailbodyhtml) . $form_template_html_footer; $mail->AltBody = $responsemail . $rmailbody . $nonhtmlfooter; } else { $mail->Body = $responsemail . "\n-----------------------------------------------\n" . $rmailbody . $nonhtmlfooter; } } if (!function_exists('doppelversand2')) { function doppelversand2() {