现在我可以发送没有附件的电子邮件:
wp_mail( $to, $subject, $message, $headers);
但是如何发送带附件的电子邮件?
答案 0 :(得分:8)
<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
答案 1 :(得分:7)
参考下文,例如
$attachments = array(WP_CONTENT_DIR . '/uploads/file_to_attach.zip');
$headers = 'From: My Name <myname@mydomain.com>' . "\r\n";
wp_mail('test@test.com', 'subject', 'message', $headers, $attachments);
答案 2 :(得分:0)
add_filter( 'wpcf7_mail_components', 'mycustom_wpcf7_mail_components' );
function mycustom_wpcf7_mail_components( $components ) {
$components['attachments'][] = 'full path of your PDF file';
return $components;
}
答案 3 :(得分:0)