Forums / Developer / Need help sending CC email in 3.1 via SMTP

Need help sending CC email in 3.1 via SMTP

Author Message

Graham Tillotson

Monday 08 September 2003 7:52:57 am

I'm trying to setup forms to use an optional CC field (similar to the demo example that uses email_receiver). I can get an email address into the CC field in my messages, but no mail is actually sent to the address. Here is what I have so far:

I declare a variable (email_cc) in collectedinfomail.tpl:

{set-block scope=root variable=email_cc}{$object.data_map.email_cc.content}{/set-block}

In collectinformation.php I add handling for this value (if it is found on a form):

$cc =& $tpl->variable( 'email_cc' );
if ( $mail->validate( $cc ) )
{
$mail->addCc( $cc );
}

The addCc function seems to work in that it gets the email address into the message (similar to setReceiver), but the CC message is not sent. At this point I'm trying to figure out what is going on in ezsendmailtransport.php. It doesn't seem like CCs are being handled here:

function sendMail( &$mail )
{
$ini =& eZINI::instance();
$emailSender = $ini->variable( 'MailSettings', 'EmailSender' );
if ( !eZMail::validate( $emailSender ) )
$emailSender = false;
$isSafeMode = ini_get( 'safe_mode' );
$isSafeMode = true;
if ( $isSafeMode and
$emailSender and
$mail->sender() == false )
$mail->setSenderText( $emailSender );
$message = $mail->body();
$extraHeaders = $mail->headerText( array( 'exclude-headers' => array( 'To', 'Subject' ) ) );
if ( $isSafeMode or
!$emailSender )
return mail( $mail->receiverEmailText(), $mail->subject(), $message, $extraHeaders );
else
return mail( $mail->receiverEmailText(), $mail->subject(), $message, $extraHeaders, '-f' . $emailSender );
}

Am I missing something obvious? Any help would be appreciated.

DUO : CONSULTING
Web content management experts
www.duoconsulting.com