【问题标题】:PHP Contact Form with Attachment带附件的 PHP 联系表
【发布时间】:2017-11-12 13:38:15
【问题描述】:

我在 html 中创建了一个联系表单。在提交表单后,电子邮件应该连同他们在表单中选择的任何文件一起发送。

【问题讨论】:

标签: php html smtp phpmailer


【解决方案1】:

查看this answer(由@sdc 回答)。使用PHPMailer 脚本。这是一个例子:

$email = new PHPMailer();
$email->From     = 'you@example.com';
$email->FromName  = 'Your Name';
$email->Subject   = 'Message Subject';
$email->Body      = $bodytext;
$email->AddAddress( 'destinationaddress@example.com' );

$file_to_attach = 'PATH_OF_YOUR_FILE_HERE';

$email->AddAttachment( $file_to_attach , 'NameOfFile.pdf' );

return $email->Send();

【讨论】:

猜你喜欢
  • 2013-11-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-05-28
  • 1970-01-01
  • 2019-08-04
  • 2017-10-08
相关资源
最近更新 更多