我的网站上有注册表格。完成后,详细信息存储在CSV文件中,但我也想向用户发送确认电子邮件。问题是电子邮件空白,我所做的是创建了一个template.php文件,其中包含我要发送的电子邮件结构,在此模板结构中,我有来自确定注册日期的其他文件的功能。 template.php中的模板包含在我在from_to_csv.php中调用的函数中,作为mail()atrebiutes的一部分:
希望这是有道理的,你们理解我看看代码:
的template.php:
function getMailContent(){
$subject = "OPES Academy- Workshop confirmation";
$message = "
| ||
Thank you for reserving your placeThanks for your registration, we will be looking forward to see you at the"; ?> require('helper.php'); echo ConvertDate( $_SESSION['date'] ); ?> $message.=" Address: 6 Thomas More Square, London, E1W 1XZ If you have any more questions we will be glad to help you, just call us on 020 3675 9000 or email us on support@opesacademy.com |
Trading and investing often involves a very high degree of risk. Past results are not indicative of future returns and financial instruments can go down as well as up resulting in you receiving less than you invested. Do not assume that any recommendations, insights, charts, theories, or philosophies will ensure profitable investment. Spread betting, trading binary options and CFD's carry a high risk to your capital, can be very volatile and prices may move rapidly against you. Only speculate with money you can afford to lose as you may lose more than your original deposit and be required to make further payments. Spread betting may not be suitable for all customers, so ensure you fully understand the risks involved and seek independent advice if necessary |
";
$headers = "Content-type: text/html\r\n";
return compact($subject, $message, $headers);
}
?>
form_to_csv.php:
$to = $data['email'];
require('template.php');
$mailContent = getMailContent();
//csv
if(@$_POST['land']=='fw'){
$path='/home/content/24/12131124/html/files/Admin/CSV_Binary/';
$fName=$path.'free_workshop-'.date( "F_j_Y" ).".csv";
//mail($to, $subject, $message, $headers,"-f info@opesacademy.com");
mail($to, $mailContent['subject'], $mailContent['message'], $mailContent['headers'],"-f info@opesacademy.com");
}
$to变量包含用户输入表单的电子邮件.....