Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require "./include/lib/mailer/PHPMailer.php";
- require "./include/lib/mailer/Exception.php";
- require "./include/lib/mailer/SMTP.php";
- use PHPMailer\PHPMailer\PHPMailer;
- use PHPMailer\PHPMailer\Exception;
- function send_mail($email, $oggetto, $messaggio, $path_allegato)
- {
- $ursername = "latuaemail@asfusf"
- $mailpass = "secret :D";
- $mail = new PHPMailer(true);
- try{
- $mail->IsSMTP(); // Utilizzo della classe SMTP al posto del comando php mail()
- $mail->SMTPAuth = true; // Autenticazione SMTP
- $mail->Host = "smtp.gmail.com";
- $mail->Port = 465;
- $mail->SMTPSecure = 'ssl';
- $mail->Username = $username; // Nome utente SMTP autenticato
- $mail->Password = $mailpass; // Password account email con SMTP autenticato
- $mail->setFrom($username, "WebMaster");
- $mail->addAddress($email);
- $mail->IsHTML(true);
- $mail->Subject = $oggetto;
- $mail->Body = $messaggio;
- $mail->AltBody = "";
- if($mail->Send())
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- catch(Exception $e)
- {
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement