2023-09-26 13:26:19 +02:00
< ? php
require_once " PHPMailer.php " ;
require_once " SMTP.php " ;
require_once " Exception.php " ;
use PHPMailer\PHPMailer\PHPMailer ;
function sendEmail ( $emailAddress , $filename , $smtppassword )
{
$mail = new PHPMailer ();
$mail -> isSMTP (); // Set mailer to use SMTP
$mail -> Host = 'smtp.titan.email; smtp.titan.email' ; // Specify main and backup SMTP servers
$mail -> SMTPAuth = true ; // Enable SMTP authentication
2024-11-10 13:44:14 +01:00
$mail -> Username = 'info@silias.ch' ; // SMTP username
2023-09-26 13:26:19 +02:00
$mail -> Password = $smtppassword ; // SMTP password
$mail -> SMTPSecure = 'ssl' ; // Enable TLS encryption, `ssl` also accepted
$mail -> Port = 465 ; // TCP port to connect to
$mail -> isHTML ( true );
2024-11-10 13:44:14 +01:00
$mail -> setFrom ( 'info@silias.ch' , 'Silias Zefix Export' );
2023-09-26 13:26:19 +02:00
$mail -> addAddress ( $emailAddress );
2023-09-26 14:27:22 +02:00
$mail -> addBCC ( 'api@zefix.silias.ch' );
2023-09-26 13:26:19 +02:00
$mail -> addReplyTo ( 'info@silias.ch' , 'Silias KLG' );
$mail -> Subject = 'Ihr Export von Zefix ist bereit' ;
2023-09-26 20:39:07 +02:00
$mail -> Body = 'Nutzen Sie den folgenden Link um ihre Daten herunterzuladen.<br><a href="https://zefix.silias.ch/' . $filename . '">https://zefix.silias.ch/' . $filename . '</a>' ;
2023-09-26 13:26:19 +02:00
if ( $mail -> send ()){
$status = " success " ;
$response = " Email is sent! " ;
}
else {
$status = " failed " ;
$response = " Something is wrong: <br> " . $mail -> ErrorInfo ;
}
echo " Email status: " . $status ;
echo " Email Response: " . $response ;
}
?>