Name in "To:" address overrules name in "Cc:" address?

Swift Mailer is a fantastic library for sending email with php. Discuss this library or ask any questions about it here.

Moderators: Chris Corbyn, General Moderators

Post Reply
HHahn
Forum Commoner
Posts: 43
Joined: Mon Mar 02, 2009 9:16 am
Location: Veldhoven, Netherlands

Name in "To:" address overrules name in "Cc:" address?

Post by HHahn »

Most websites that offer e-mail forms don't bother to automatically return a copy to the sender. Whenever I make an e-mail form, I always have it send a copy to the visitor, usually with a text like "(your own copy)" after the Cc: e-mail address.

I am now implementing this in SwiftMailer. However, SwiftMailer seems to ignore the "name" parameter in the $Recipients->addCC() call and tacitly replaces it by the name specified in the $Recipients->addTo() call.
If I use another addTo instead of addCC, then the name specified in the first addTo is used for both copies!

Is this intentional, and if so, why?

Is there another way to have a different name for the CC adress, without sending the same message twice?

[edited/added:]
I now see that the above is not quite accurate. What actually happens is that the contents of the CC field is replaced by a copy of the contents of the To field. So if I do the following:

Code: Select all

...->addTo ("addr1@isp1.tld", Addressee1);
...->addCC ("addr2@isp2.tld", Addressee2); 
it actually executes as if I had given:

Code: Select all

...->addTo ("addr1@isp1.tld", Addressee1);
...->addCC ("addr1@isp1.tld", Addressee1);
Changing the order of addTo and addCC does not help. So it is not a matter of the first one being overwritten by the secind one, but actually CC is overwritten bi To.

Am I doing something wrong, or is this a bug? In the latter case, will it be remedied in version 4?
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Name in "To:" address overrules name in "Cc:" address?

Post by Chris Corbyn »

Which send() method are you using? send() or batchSend()?
HHahn
Forum Commoner
Posts: 43
Joined: Mon Mar 02, 2009 9:16 am
Location: Veldhoven, Netherlands

Re: Name in "To:" address overrules name in "Cc:" address?

Post by HHahn »

I was using

Code: Select all

$R = $Swift->send ($Message, $Receivers, $From);
with the result described in my previous post.

I now changed this temporarily to

Code: Select all

$R = 0;
$R += $Swift->send ($Message, $AddressTo, $From);
$R += $Swift->send ($Message, $AddressCC, $From);
with $AddressCC containing the CC address which is now technically used as another To address.
This works, but I don't like this solution.

One extra remark.
On the domain where I first tested SwiftMailer, I did not (yet) try this aspect, I used an SMTP connection there. On the domain where I am now for the first time implementing Swiftmailer for "real life", SMTP does not seem to be available and I am using a Native Mail connection. (The ISP claims to be one of the biggest ISPs in Europe (Strato). They are technically pretty good, but their helpdesk is extremely difficult to contact. So I prefer not to try and find out anything that way.)
HHahn
Forum Commoner
Posts: 43
Joined: Mon Mar 02, 2009 9:16 am
Location: Veldhoven, Netherlands

Re: Name in "To:" address overrules name in "Cc:" address?

Post by HHahn »

I hit the wrong link in this forum and so unintendedly "bumped" this topic. I'm not sure what "bumping" is supposed to mean here, but I would appreciate if someone can "undo" this as the problem described in this topic is not yet solved.
Thanks.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Name in "To:" address overrules name in "Cc:" address?

Post by Chris Corbyn »

That's really weird and I suspect the bug is with either the mail() function, or the underlying server configuration for sendmail. What happens if you do this?

Code: Select all

mail(
  'Addressee 1 <addr1@isp1.tld>',
  'Example Subject',
  'Test message',
  "From: Your Name <your@address.tld>\r\n" .
  "Cc: Addressee 2 <addressee@isp2.tld>\r\n"
);
HHahn
Forum Commoner
Posts: 43
Joined: Mon Mar 02, 2009 9:16 am
Location: Veldhoven, Netherlands

Re: Name in "To:" address overrules name in "Cc:" address?

Post by HHahn »

Thanks for the tip. mail() does exactly the same as I described. But I now see that the actual problem seems to be caused in my e-mail client (Thunderbird). I did something like:

Code: Select all

$Receivers = new Swift_RecipientList();
$Receivers ->addTo ("me@mydomain.tld", "direct e-mail");
$Receivers ->addCC ("me@otherdomain.tld", "via otherdomain.tld");
where me@otherdomain.tld is an address that redirects to me@mydomain.tld.
The idea was that the name field as shown in the recipient column in the list of received messages would show which one of the messages it it. But Thunderbird seems to show the To: address, even if it is not my addres at all. The only way to find out which of the two essages it is, is looking in the message source.

So I will now transfer this problem to the Thunderbird forum.
Anyway, thanks for "listening".
Post Reply