関数 send() を編集して、woo コマース プラグインでファイルを添付するようにしました。添付ファイルのパスを静的に使用しているのですが、動的に添付ファイル ソースに配置すると、添付ファイルを送信できませんが、メールを取得しています。データベースから画像を取得してメールに添付するために選択クエリを使用しています。
function send( $to, $subject, $message, $headers, $attachments ) {
global $wpdb;
$current_post1=$post->ID;
$result1=$wpdb->get_results("SELECT BgImageName FROM ca_woocommerce_order_items where order_id = $current_post1 ");
foreach ( $result1 as $print1 )
echo $imgemail=$print1->BgImageName;
//static path it's work
//$attachments = array( '/home2/rahulr/public_html/cutting-edge/wordpress_theme/user_templates/1384010402.png' );
//dynamic path it's not working
$attachments = array('/home2/rahulr/public_html/cutting-edge/wordpress_theme/user_templates/'.$imgemail);
add_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
add_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
add_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
wp_mail( $to, $subject, $message, $headers, $attachments );
remove_filter( 'wp_mail_from', array( $this, 'get_from_address' ) );
remove_filter( 'wp_mail_from_name', array( $this, 'get_from_name' ) );
remove_filter( 'wp_mail_content_type', array( $this, 'get_content_type' ) );
}