开发者

How to send an email with attachment in wordpress?

开发者 https://www.devze.com 2023-02-01 20:49 出处:网络
Now I can send an email without attachment : wp_mail( $to, $subject, $message, $headers); But how can I send an email with attachment?开发者_JAVA技巧 <?php wp_mail( $to, $subject, $message, $hea

Now I can send an email without attachment :

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

But how can I send an email with attachment?开发者_JAVA技巧


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

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


Refer below e.g.

$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);


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;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消