【问题标题】:reply only pdf / img phpmailer只回复 pdf / img phpmailer
【发布时间】:2020-04-17 17:28:56
【问题描述】:

我正在尝试发送一个 pdf 的答案,我已经尝试过并且一切顺利,但我希望答案(回复)仅获取 pdf,而不是表单输入的数据。

我的问题是,当您回答时,是否有可能只有 pdf 会到达而无需获取我在表单中输入的数据?

1- 我收到表单数据 2- 填写表格的人收到一个pdf/img,但是表格中输入的数据没有到达

<?php

$nombre = $_POST['name'];

$email = $_POST['email'];
$telefono = $_POST['phone'];


use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require './Exception.php';
require './PHPMailer.php';
require './SMTP.php';

$mail = new PHPMailer(true);

try {
    //Server settings
    $mail->SMTPDebug = 0;                      // Enable verbose debug output
    $mail->isSMTP();                                            // Send using SMTP
    $mail->Host       = 'smtp.gmail.com';                    // Set the SMTP server to send through
    $mail->SMTPAuth   = true;                                   // Enable SMTP authentication
    $mail->Username   = '*****@******';                     // SMTP username
    $mail->Password   = '*****';                               // SMTP password
    $mail->SMTPSecure = 'tls ';    // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
    $mail->Port       = 587;                                    // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` above

    //Recipients
    $mail->setFrom('******@***', 'Página web' );



    $mail->addReplyTo($email);
    $mail->addCC($email);
    $mail->addBCC($email); 

    // Attachments
    $mail->addAttachment('atencion-memoria.pdf');
            // Add attachments



$message  = "<html><body>";


$message .= "<table align='center' width='100%' border='0' cellpadding='0' cellspacing='0' style='max-width:650px; background-color:#fff; font-family:Verdana, Geneva, sans-serif;'>";



$message .= "<tbody>



<tr style='border-radius:10px'>
    <th style='color:white;background:linear-gradient(50deg,rgb(15,90,224) 0%,rgb(15,90,224) 0%,rgb(116,0,186) 100%,rgb(116,0,186) 100%);text-align:center;padding:10px'>Nombres</th>
    <td style='padding:10px'>
    <p style='font-size:15px;font-family:Century Gothic;margin:2px'>".$nombre."</p>

    </td>

  </tr>


  <tr style='border-radius:10px'>
    <th style='color:white;background:linear-gradient(50deg,rgb(15,90,224) 0%,rgb(15,90,224) 0%,rgb(116,0,186) 100%,rgb(116,0,186) 100%);text-align:center;padding:10px'>Email</th>
    <td style='padding:10px'>
    <p style='font-size:15px;font-family:Century Gothic;margin:2px'>".$email."</p>

    </td>

  </tr>

  <tr style='border-radius:10px'>
    <th style='color:white;background:linear-gradient(50deg,rgb(15,90,224) 0%,rgb(15,90,224) 0%,rgb(116,0,186) 100%,rgb(116,0,186) 100%);text-align:center;padding:10px'>Teléfono</th>
    <td style='padding:10px'>
    <p style='font-size:15px;font-family:Century Gothic;margin:2px'>".$telefono."</p>

    </td>

  </tr>


              </tbody>";

$message .= "</table>";



$message .= "</body></html>";
    // Content
    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Pagina de Bienestar ';
    $mail->AltBody = 'mensaje alternativo 11';
    $mail->Body    =  $message ;


    $mail->send();
    echo "<script language='javascript'>
    window.location.href = '*****';
    </script>";
} catch (Exception $e) {
    echo "Error: {$mail->ErrorInfo}";
}

【问题讨论】:

    标签: php html phpmailer


    【解决方案1】:

    当然!

    只是不要在$mail-&gt;Body = $message; 中分配表单,并且您不会将表单添加到电子邮件中:

    $mail->isHTML(true);                                  // Set email format to HTML
    $mail->Subject = 'Pagina de Bienestar ';
    $mail->AltBody = 'mensaje alternativo 11';
    $mail->Body    =  $message ;
    
    // to
    $mail->isHTML(false);                                  // Set email format to HTML
    $mail->Subject = 'Pagina de Bienestar ';
    $mail->Body = 'mensaje alternativo 11';
    

    【讨论】:

    • 谢谢你,朋友,但我想要的是让我收到这个人在我网站上的表格中输入的信息,并且这个人通过到达 pdf / img 来响应。 // 那么你的解决方案没有给我表格上的信息:(//对不起,我想我没有在上面解释清楚
    • 只需echo $message; 即可将您的表单放到页面上
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-08-14
    • 1970-01-01
    相关资源
    最近更新 更多