php - 自动回复功能与显示名称而不是电子邮件的电子邮件标题一起使用
问题描述
我得到了这个代码。但是由于尝试包含标题,我不再收到电子邮件。我得到了 PHP 7.4 版
#hook in to wpcf7_mail_sent - this will happen after form is submitted
add_action( 'wpcf7_mail_sent', 'contact_form_autoresponders' );
#our autoresponders function
function contact_form_autoresponders( $contact_form ) {
if( $contact_form->id==14383 ){
#retrieve the details of the form/post
$submission = WPCF7_Submission::get_instance();
$posted_data = $submission->get_posted_data();
$headers = 'From: "Name Lastname" <myemail@mail.com>' . "\r\n" .
'Reply-To: "Name Lastname" <myemail@mail.com>' . "\r\n" .
'X-Mailer: PHP/' . phpversion();
#set autoresponders based on dropdown choice
switch( $posted_data['states'] ){
case 'California':
$msg="California email body goes here";
break;
case 'Texas':
$msg="Texas email body goes here";
break;
}
#mail it to them
mail( $posted_data['email'], 'Thanks for your enquiry', $msg, $headers);
}
}
怎么了!?
解决方案
推荐阅读
- tensorflow - BERT 模型中的 input_ids、input_mask 和 segment_ids 变量来自哪里?
- angular - 角度代理配置
- webpack - webpack 创建 bundle 可能是下载的问题
- dart - 如何在颤振中舍入一个双精度值
- python - 逐帧读取并在 python 中使用 cv2 创建视频
- android - Sentry 的 Gradle 任务未编译
- android - 当我们在物理手机上运行android应用程序时是否也使用.dex文件?
- servicestack - 如何转换 SqlExpression
进入 SqlExpression 使用 ServiceStack OrmLite? - oracle-sqldeveloper - SQL Developer 缺少一个库
- kubernetes - Kubernetes 上的散景服务定期重启是否正常?