1 回答

TA貢獻2021條經驗 獲得超8個贊
生成文件后,函數可以使用wp_mail函數發送它。
add_action( 'wpcf7_before_send_mail', 'CF7_pre_send' );
function CF7_pre_send($cf7) {
$output = "";
$output .= "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>Name: " . $_POST['your-name'];
$output .= "Email: " . $_POST['your-email'];
$output .= "Message: " . $_POST['your-message'];
file_put_contents( "cf7outputtest.xml", $output);
// then send email
$to = "[email protected]";
$subject = "The subject";
$body = "The email body content";
$headers = "From: My Name <[email protected]>" . "\r\n";
$attachments = array( "cf7outputtest.xml" );
wp_mail( $to, $subject, $body, $headers, $attachments );
}
- 1 回答
- 0 關注
- 179 瀏覽
添加回答
舉報