使用wp_mail()处理电子邮件和附件。如果上传的附件是临时存储的,并且在发送电子邮件后删除了,我会更喜欢。目前,上传/附件已保存在服务器上。如何防止这种情况?
appExcel.Visible = true;
classeur = appExcel.Workbooks.Open(DB_Path, 0, false, 5, "", "", true, XlPlatform.xlWindows, "\t", false, false, 0, true, 1, 0);
appExcel.Visible = false;
答案 0 :(得分:1)
您是否关心它是否成功发送?
如果没有,那就这样做:
if( $wp_mail_return ) {
echo 'Mail send';
} else {
echo 'Failed';
}
// Loops over the attachments (per your array), and removes the file
foreach ( (array)$attachments AS $file ) {
unlink( $file );
}
如果您只是想成功发送,请将其移至if条件中:
if( $wp_mail_return ) {
echo 'Mail send';
// Loops over the attachments (per your array), and removes the file
foreach ( (array)$attachments AS $file ) {
unlink( $file );
}
} else {
echo 'Failed';
}