Exemple #1
0
<?php

header("Access-Control-Allow-Origin: *");
require "phpmailer/class.phpmailer.php";
$path_parts = pathinfo($_FILES['userfile']['name']);
$mail = new PHPmailer();
$mail->SMTPAuth = false;
$mail->IsHTML(true);
$mail->From = $_POST['from'];
$mail->AddAddress($_POST['destinataire']);
//$mail->AddAddress($_POST['from']);
$mail->AddReplyTo($_POST['from']);
error_log("from:" . $_POST['from']);
if (isset($_FILES['userfile'])) {
    $mail->AddAttachment($_FILES['userfile']['tmp_name'], 'photo.' . substr($path_parts['extension'], 0, 3));
}
$mail->Subject = "Message envoyé depuis l'application L'Autre Radio " . date('d/m/Y') . " à " . date('G:i');
$mail->Body = '	Bonjour,
					<p>Message envoyé le ' . date('d/m/Y') . ' à ' . date('G:i') . ' depuis l\'application L\'Autre Radio</p>
					<p>Informations de la personne :</p>
					<div><strong>Nom :</strong> ' . $_POST['nom'] . '</div>
					<div><strong>Email :</strong> ' . $_POST['mail'] . '</div>
					<div><strong>Mobile :</strong> ' . $_POST['mobile'] . '</div>
					<div><strong>Message :</strong> ' . $_POST['message'] . '</div>';
if (!$mail->Send()) {
    $messageError1 = $mail->ErrorInfo;
} else {
    $messageError1 = 'Mail envoyé avec succès';
}
unset($mail);
error_log("retour:" . $messageError1);
Exemple #2
0
function enviamail($dest, $id_gr, $body_mail, $anex)
{
    require '../mail/class.phpmailer.php';
    //$emaildest = (string)$dest;
    $mail = new PHPmailer();
    $mail->IsSMTP();
    $mail->IsHTML(true);
    $mail->Helo = $_SESSION['helo_envio_mail_send_supplier'];
    //$mail->SMTPSecure='SSL';
    $mail->Port = $_SESSION['port_envio_mail_send_supplier'];
    $mail->Username = $_SESSION['login_mail_send_supplier'];
    $mail->Password = $_SESSION['password_mail_send_supplier'];
    $mail->Host = $_SESSION['host_envio_mail_send_supplier'];
    $mail->From = $_SESSION['from_mail_send_supplier'];
    $mail->SetFrom = $_SESSION['setfrom_mail_send_supplier'];
    foreach ($dest as $db => $value) {
        $mail->AddAddress($value);
    }
    //$mail->AddAddress($emaildest);
    $mail->AddCC($_SESSION['addcc_mail_send_supplier']);
    #$mail->AddReplyTo('*****@*****.**', 'Administrator JO2012');
    $mail->Subject = 'GR Nº' . $id_gr;
    $mail->Body = '<html><body>Bom dia,<br /><br />' . $body_mail . '<br/><br/>Obrigado pela atenção.</body></html>';
    $pdf = createpdf($id_gr);
    $attachment = $pdf->Output('GR numero ' . $id_gr . '.pdf', 'S');
    $mail->AddStringAttachment($attachment, 'GR numero ' . $id_gr . '.pdf');
    //verifica se existe um talão porque se existe é sempre para enviar
    if (strpos($id_gr, '-') !== false) {
        $data = grepGetByGrNumber($id_gr);
    } else {
        $data = grepGetById($id_gr);
    }
    //$data = grepGetById($id_gr);
    //$urlguia = $data['url_talao'];
    if ($data['url_talao'] != "") {
        $mail->AddAttachment('../' . $data['url_talao'], 'talao.pdf');
    }
    unset($data);
    if ($anex != '') {
        $mail->AddAttachment($anex);
    }
    if ($mail->Send()) {
        $mail->ErrorInfo;
        $mail->SmtpClose();
        unset($mail);
        //$erro = true;
        #return 'Verifica o email introduzido (ex: meumail@mail.com)';
        return false;
    } else {
        //$erro = false;
        $mail->SmtpClose();
        unset($mail);
        #return 'Email enviado com sucesso';
        return true;
    }
    #$mail->SmtpClose();
    #unset($mail);
}
Exemple #3
0
 $mail->AddReplyTo("{$techrow['mail']}");
 $mail->AddCC("{$rparameters['mail_cc']}");
 if ($_POST['usercopy'] != '') {
     $mail->AddCC("{$_POST['usercopy']}");
 }
 if ($_POST['usercopy2'] != '') {
     $mail->AddCC("{$_POST['usercopy2']}");
 }
 if ($_POST['usercopy3'] != '') {
     $mail->AddCC("{$_POST['usercopy3']}");
 }
 if ($_POST['usercopy4'] != '') {
     $mail->AddCC("{$_POST['usercopy4']}");
 }
 if ($globalrow['img1'] != '') {
     $mail->AddAttachment("./upload/{$_GET['id']}/{$globalrow['img1']}");
 }
 if ($globalrow['img2'] != '') {
     $mail->AddAttachment("./upload/{$_GET['id']}/{$globalrow['img2']}");
 }
 if ($globalrow['img3'] != '') {
     $mail->AddAttachment("./upload/{$_GET['id']}/{$globalrow['img3']}");
 }
 $mail->Subject = "{$objet}";
 $mail->Body = "{$msg}";
 if (!$mail->Send()) {
     echo '<div id="erreur"><img src="./images/access.png" alt="erreur" style="border-style: none" alt="img" />';
     echo $mail->ErrorInfo;
     echo '</div>';
 } else {
     echo "<center><div id=\"valide\"><img src=\"./images/mail.png\" border=\"0\" /> Message envoyé.</div></center>";