6

现在我可以发送没有附件的电子邮件:

wp_mail( $to, $subject, $message, $headers);

但是如何发送带有附件的电子邮件?

4

3 回答 3

8
 <?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?> 

http://codex.wordpress.org/Function_Reference/wp_mail

于 2010-12-29T15:47:41.930 回答
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);
于 2012-06-27T19:28:59.943 回答
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;
}
于 2013-08-20T06:07:00.357 回答