Php wp_邮件附件无法动态工作
我在woo commerce插件中编辑了函数send()以附加文件。当我静态使用附件文件路径时,它可以工作,但当我将其置于动态附件源上时,我无法发送附件,但我正在接收邮件。我正在使用选择查询从数据库获取图像以附加到邮件中Php wp_邮件附件无法动态工作,php,wordpress,email,woocommerce,Php,Wordpress,Email,Woocommerce,我在woo commerce插件中编辑了函数send()以附加文件。当我静态使用附件文件路径时,它可以工作,但当我将其置于动态附件源上时,我无法发送附件,但我正在接收邮件。我正在使用选择查询从数据库获取图像以附加到邮件中 function send( $to, $subject, $message, $headers, $attachments ) { global $wpdb; $current_post1=$post->ID; $result1=
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' ) );
}
你能显示打印出来的
$imgemail=$print1->BgImageName
吗?我不能打印,因为它是在paypal之后处理的。但我在另一个页面中使用的同一个查询其工作原理我也尝试了这个会话变量,但没有得到任何结果@ObmerkKronen@SanjayNakate,你找到解决办法了吗?我有完全相同的问题,它正在杀死我。