fixing E-Mail
This commit is contained in:
+1
-35
@@ -2,11 +2,7 @@
|
||||
include "zefixAPI.php";
|
||||
include "read_write_xlsx.php";
|
||||
|
||||
require_once "PHPMailer.php";
|
||||
require_once "SMTP.php";
|
||||
require_once "Exception.php";
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
include "emailSender.php";
|
||||
|
||||
$maxExecutionTime = 300;
|
||||
$taskDir = 'tasks';
|
||||
@@ -47,37 +43,7 @@ function doRequest($data, $filename, $username, $password)
|
||||
|
||||
|
||||
|
||||
function sendEmail($emailAddress, $filename, $smtppassword)
|
||||
{
|
||||
$mail = new PHPMailer();
|
||||
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = 'smtp.titan.email'; // Specify main and backup SMTP servers
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = 'api@zefix.silias.ch'; // SMTP username
|
||||
$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);
|
||||
$mail->setFrom('api@zefix.silias.ch', 'Silias Zefix Export');
|
||||
$mail->addAddress($emailAddress);
|
||||
$mail->addReplyTo('info@silias.ch', 'Silias KLG');
|
||||
$mail->Subject = 'Ihr Export von Zefix ist bereit';
|
||||
$mail->Body = 'Nutzen Sie den folgenden Link um ihre Daten herunterzuladen. Die Daten werden nach 48 Stunden automatisch von unserem Server gelöscht.\n<a href="https://zefix.silias.ch/'.$filename.'">https://zefix.silias.ch/'.$filename.'</a>';
|
||||
|
||||
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;
|
||||
}
|
||||
// Stop executing bevore reaching PHP Max Execution Time
|
||||
function convertcsvToXlsx(string $csvFile, string $xlsxFile)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user