There’s two ways of approaching this that I can think of, both are kinda ugly..
1. You can hack eForm and make yourself a new parameter for the extra subject.
2. You copy the code from eform for sending the second mail and place that in an event function, adapting it to have a custom subject. Something like this should do it. If not, experiment with it (I didn’t try out this code).
//<?php
// place function in a new snippet and call this snippet (uncached)
// before eForm in your document.
if(!function_exists('extraMail')){
function extraMail(){
global $modx;
//get bodytext template from a chunk
$bodytext = efLoadTemplate('yourChunk');
$bodytext = formMerge($bodytext,$fields);
//prepare mail
$mail = new PHPMailer();
$mail->IsMail();
$mail->CharSet = $modx->config['modx_charset'];
$mail->IsHTML(true); //change to false for plain text
$mail->From = '[email protected]';
$mail->FromName = 'Ziestha';
$mail->Subject = 'My custom Subject....';
$mail->Body = $bodytext;
AddAddressToMailer($mail,"to",$fields['email']);
if(!$mail->send())
return 'AutoText: ' . $_lang['ef_mail_error'] . $mail->ErrorInfo;
}
}
To make it work in the eForm call you set &eFormOnMailSent=`extraMail` and remove the &automessage, &autosender and the &autoSenderName parameters. The latter 3 are now dealt with in the function instead (
and you would want them to receive 2 email would you). Please do realize that you do not have direct access to eForm’s parameters within the event function, so you may have to hard code the data as I’ve done here.
The second option must seem the best choice now that I’ve done most of the work for you, so be nice and throw a few coins in the
donation box to keep the team going...