Sil*_*tun 5 php email wordpress
我试图通过wp_mail函数从表单发送带有附件的电子邮件,而不将文件上传到文件管理器。我收到带有附件的电子邮件。但是附件名称不正确,没有文件类型。请帮助解决此问题。
这是HTML表格
<form action="POST" enctype="multipart/form-data">
<table>
<input type="file" name="Attached">
<input type="Submit" name="Submit">
</table>
</form>
Run Code Online (Sandbox Code Playgroud)
有我的PHP代码
if (isset($_POST['Submit'])) {
$attachments = $_FILES['Attached']['tmp_name'];
$recipients = "john@mail.com";
$SenderName = get_bloginfo('name');
$SenderEmail = "noreply@domain.com";
$body = "How are you what are you doing now. bla bla bla";
$recipients = array($to);
$headers[] = "From: $SenderName <$SenderEmail>" . "\r\n";
$headers[] = "Content-Type: text/html";
$subj = "This is mail subject";
$SendMail = wp_mail( $recipients, $subj, $body, $headers, $attachments );
}
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1239 次 |
最近记录: |