Want to modify 'to' line in message header
Posted: Tue Oct 23, 2007 2:27 pm
Hi there,
I am using the recipients object to handle multiple addresses.
That works fine but occasionally we use internal group email addresses.
These addresses are not actual email addresses therefore the group addresses
are not in the recipient list. But I need to provide them in the to line in the
header. Is there a way to do that?
I saw in other posts and in the manual that Swift creates the header on the fly while sending
from the recipient list so $message->setTo('foo@bar.com') does not help in this case.
Here is an example:
Thanks for your help!
Peter
I am using the recipients object to handle multiple addresses.
That works fine but occasionally we use internal group email addresses.
These addresses are not actual email addresses therefore the group addresses
are not in the recipient list. But I need to provide them in the to line in the
header. Is there a way to do that?
I saw in other posts and in the manual that Swift creates the header on the fly while sending
from the recipient list so $message->setTo('foo@bar.com') does not help in this case.
Here is an example:
Code: Select all
// new message
$message= new Swift_Message($subject);
// entered recipient addresses
// first one is group address
$entered_address = array('group@address.com', 'foo@bar.com');
// new recipient list
// add only the actual valid email address
// plus group member as Bcc's
$recipients = new Swift_RecipientList();
$recipients->addTo('foo@bar.com');
$recipients->addBcc('groupMember_1@bar.com');
$recipients->addBcc('groupMember_2@bar.com');
// but need group address in header so that recipents sees that group address has entered
$message->setTo(array('group@address.com', 'foo@bar.com'));
App['SwiftMailer']->send($message, $recipients, "me@mydomain.com");Thanks for your help!
Peter