WordPressで添付ファイルでメールを送信する方法は?
-
13-10-2019 - |
質問
これで、添付ファイルなしでメールを送信できます。
wp_mail( $to, $subject, $message, $headers);
しかし、添付ファイルでメールを送信するにはどうすればよいですか?
解決
<?php wp_mail( $to, $subject, $message, $headers, $attachments ); ?>
他のヒント
以下を参照してください
$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;
}
所属していません StackOverflow