我正在编辑一个使用一些奇怪的Smarty系统,模板TPL文件和一堆JS和PHP构建的网站。
我有一个PHP文件中的Classes,它们从不同的PHP文件发送电子邮件并发送电子邮件到一组电子邮件地址。
我想添加到此数组,以便将电子邮件的副本发送给填写表单的人员。
配方数组是:
//target email address settings
$this->settings['mailer_address_booknow'] = array('ADDRESS@ADDRESS.com', 'ADDRESS@ADDRESS.com', 'ADDRESS@ADDRESS.com', 'james@bernhardmedia.com');
发送PHP文件是:
public function SendEmail( $email_address_array, $email_data, $subject, $template, &$send_message ) {
$smartyObj = Configurator::getInstance()->smarty;
$send_message = '';
$send_result = 0;
try {
$mail = new PHPMailer( true );
$mail->IsSMTP( true );
$mail->SMTPDebug = false;
$mail->IsHTML( true );
$mail->Host = Configurator::getInstance()->getSettings( "phpmailer_smtp" );
$mail->ClearAddresses();
for( $x = 0;$x < sizeof($email_address_array);$x++ ){
$mail->AddAddress( trim($email_address_array[$x]) );
}
$smartyObj->assign( 'email_data', $email_data );
$mail->SetFrom( 'info@forexchange.co.uk', 'Forexchange Currency Order');
$mail->Subject = $subject;
$mail->Body = $smartyObj->fetch( $template );
if(!$mail->Send()) {
} else {
$send_result = 1;
}
} catch (phpmailerException $e) {
$send_message = $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
$send_message = $e->getMessage(); //Boring error messages from anything else!
}
//echo $send_result;
//exit;
return $send_result;
}
表单位于本网站的主页上 - http://www.forexchange.co.uk/
请帮助,我很难过!
答案 0 :(得分:0)
Smarty我认为是针对php的Smarty模板引擎,请参阅here
将电子邮件地址附加到数组$email_address_array
调用方法时
SendEmail( $email_address_array, $email_data, $subject, $template, &$send_message );
在您调用之前将电子邮件附加到该数据集($email_address_array
)或将其附加到内联(在通话中)
你能说明你怎么称呼它吗?
EDIT 如果您的数据存储在
中 $this->settings['mailer_address_booknow'];
将其添加到通话中
SendEmail( $this->settings['mailer_address_booknow'] , $email_data, $subject, $template, &$send_message );
如果您需要添加到该数组,请在调用之前执行此操作
$this->settings['mailer_address_booknow'] = "ADDED_EMAIL";