【发布时间】: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}";
}
【问题讨论】: