start copy from cimac web
This commit is contained in:
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
//You shall use the following exact namespaces no
|
||||
//matter in whathever directory you upload your
|
||||
//phpmailer files.
|
||||
|
||||
use PHPMailer\PHPMailer\PHPMailer;
|
||||
use PHPMailer\PHPMailer\Exception;
|
||||
//include('include/headscript.php');
|
||||
require 'phpmailer/src/Exception.php';
|
||||
require 'phpmailer/src/PHPMailer.php';
|
||||
require 'phpmailer/src/SMTP.php';
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($_GET["tokenupdate"])) {
|
||||
|
||||
|
||||
// Recipient
|
||||
$to = $emailuser;
|
||||
|
||||
// Sender
|
||||
$from = $fromaddresssmail;
|
||||
$fromName = 'CIMAC Application Form System';
|
||||
|
||||
// Email subject
|
||||
$subject = 'Token per Firma Digitale';
|
||||
|
||||
// Attachment file
|
||||
$mmessage="mailtoken";
|
||||
|
||||
include('mailhtml.php');
|
||||
// Email body content
|
||||
$htmlContent = $mailmessagetoken;
|
||||
|
||||
|
||||
/*
|
||||
// Header for sender info
|
||||
$headers = "From: $fromName"." <".$from.">";
|
||||
|
||||
// Boundary
|
||||
$semi_rand = md5(time());
|
||||
$mime_boundary = "==Multipart_Boundary_x{$semi_rand}x";
|
||||
|
||||
// Headers for attachment
|
||||
$headers .= "\nMIME-Version: 1.0\n" . "Content-Type: multipart/mixed;\n" . " boundary=\"{$mime_boundary}\"";
|
||||
|
||||
// Multipart boundary
|
||||
$message = "--{$mime_boundary}\n" . "Content-Type: text/html; charset=\"UTF-8\"\n" .
|
||||
"Content-Transfer-Encoding: 7bit\n\n" . $htmlContent . "\n\n";
|
||||
|
||||
|
||||
|
||||
// Send email
|
||||
$mail = @mail($to, $subject, $message, $headers, $returnpath);
|
||||
|
||||
} */
|
||||
?>
|
||||
<? //smtp
|
||||
|
||||
$mail = new PHPMailer(true);
|
||||
try {
|
||||
$mail->isSMTP(); // Set mailer to use SMTP
|
||||
$mail->Host = $mailhost; // Specify main and backup server
|
||||
$mail->SMTPAuth = true; // Enable SMTP authentication
|
||||
$mail->Username = $mailusername; // SMTP username
|
||||
$mail->Password = $mailpassword; // SMTP password
|
||||
$mail->SMTPSecure = $mailmethod; // Enable encryption, 'ssl' also accepted
|
||||
$mail->Port = $mailport;
|
||||
|
||||
|
||||
$mmessage="mailtoken";
|
||||
include('mailhtml.php');
|
||||
// Email body content
|
||||
|
||||
|
||||
$htmlContent = $mailmessagetoken;
|
||||
|
||||
|
||||
$mail->From = $from;
|
||||
$mail->FromName = 'CIMAC Application Form System';
|
||||
$mail->addAddress($to); // Add a recipient
|
||||
|
||||
|
||||
|
||||
$mail->Subject = $subject;
|
||||
$mail->Body = $htmlContent;
|
||||
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';
|
||||
|
||||
$mail->send();
|
||||
// echo 'Message has been sent';
|
||||
} catch (Exception $e) {
|
||||
echo "Message could not be sent. Mailer Error: {$mail->ErrorInfo}";
|
||||
}}
|
||||
?>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user