繁体   English   中英

如何在wordpress中发送带附件的电子邮件?

[英]How to send an email with attachment in wordpress?

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

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

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

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

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

请参考下文

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

我写了一个插件,用于发送带有WP附件的电子邮件。

“快速邮件”从仪表板发送带有附件的文本或HTML电子邮件。 HTML电子邮件可以包含短代码。

WordPressGithub获取Quick Mail。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM