문제

Now I can send an email without attachment :

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

But how can I send an email with attachment?

도움이 되었습니까?

해결책

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

I wrote a plugin to send to emails with attachments from WP.

Quick Mail sends text or HTML emails with attachments from the dashboard. HTML emails can include shortcodes.

Get Quick Mail from WordPress or Github.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top