First Commit
This commit is contained in:
58
html/sternwarte/phpmailer/dosendmail.php_copy
Normal file
58
html/sternwarte/phpmailer/dosendmail.php_copy
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
function sendmail($subject, $from, $body, $cc=[], $bcc=[], $to=[]) {
|
||||
global $develop;
|
||||
|
||||
$ret = [];
|
||||
$ret['error'] = false;
|
||||
|
||||
|
||||
$mail = new PHPMailer();
|
||||
$mail->CharSet = 'utf-8';
|
||||
$mail->isSMTP();
|
||||
|
||||
if ($develop == 'true') {
|
||||
$mail->Host = 'mailhog';
|
||||
$mail->Port = 1025;
|
||||
} else {
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Host = "sslout.df.eu";
|
||||
$mail->Port = "465";
|
||||
$mail->SMTPSecure = "ssl";
|
||||
$mail->Username = "sonderfuehrung@sternwarte-welzheim.de";
|
||||
$mail->Password = "v|kR9D8m}K";
|
||||
}
|
||||
$mail->setFrom($from);
|
||||
if (count($to) != 0) {
|
||||
foreach ($to as $t) {
|
||||
$mail->addAddress($t);
|
||||
}
|
||||
}
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $body;
|
||||
if (count($cc) != 0) {
|
||||
foreach ($cc as $c) {
|
||||
$mail->addCC($c);
|
||||
}
|
||||
}
|
||||
if(count($bcc) != 0) {
|
||||
foreach ($bcc as $bc) {
|
||||
$mail->addBCC($bc);
|
||||
}
|
||||
}
|
||||
$mail->addReplyTo($from);
|
||||
|
||||
if (!$mail->send()) {
|
||||
$ret['error'] = true;
|
||||
$ret['errortext'] = $mail->ErrorInfo;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user