|
NoiseEee - 2005-08-24 17:17:16
Hi there
I use Manuel Lemos' excellent email_message class for some time now, on various websites. All of a sudden (or perhaps, just not really tested until now Wink ) there are problems when sending messages to more than one recipient.
Recipient addresses come from a web form. There are no problems or errors when a single recipient is specified (ie: joe@example.com). However, when a user enters more than one recipient, seperated by a comma as per the class instructions, my mail server sends me an error-report:
---------------------
This is the Postfix program at host **.*****.com.
I'm sorry to have to inform you that the message returned
below could not be delivered to one or more destinations.
For further assistance, please send mail to <postmaster>
If you do so, please include this problem report. You can
delete your own text from the message returned below.
The Postfix program
<"silver@example.com, rocket"@hotmail.com>: host mx1.hotmail.com[65.54.252.99]
said: 501 Invalid Address (in reply to RCPT TO command)
-------------------------
Clearly you can see the problem - the quotes come before the second email address' "@" sign, instead of after the complete email address.
Does anyone have any suggestions as to why this might not work? Might something have changed on my server? I test pretty extensively before putting things in production, so I'm sure I was able to do this at one time....
Thanks...
Manuel Lemos - 2005-08-24 17:44:28 - In reply to message 1 from NoiseEee
In that case you should use the SetMultipleEncodedEmailHeader as explained in the class documentation, like this:
$message_object->SetMultipleEncodedEmailHeader('To', array(
'peter@gabriel.org' => 'Peter Gabriel',
'paul@simon.net' => 'Paul Simon',
'mary@chain.com' => 'Mary Chain'
);
NoiseEee - 2005-08-25 15:57:23 - In reply to message 2 from Manuel Lemos
Hi
Thanks for the reply - I've switched to SetMultipleEncodedEmailHeader, and I've assembled the array via the following, where $vToAddress is a comma separated list of email addresses. I don't have names, so I use the persons email address as their name as well:
**********
$vArrayString = "";
foreach($vToAddress as $key=>$value) {
$value = trim($value);
$vArrayString .= "'$value'=>'$value',";
}
$vArrayString = substr($vArrayString, 0, -1);
$email_message->SetMultipleEncodedEmailHeader('To',array($vArrayString));
***********
echo'ing my $vArrayString prints:
*****
'hi@example.com'=>'hi@example.com','there@example.com'=>'there@example.com','again@example.com'=>'again@example.com'
*****
which I believe is correct, according to the example... however, when running the class, the script processes successfully, but my email server mails me an error report saying:
<unknown>: No recipients specified
And, of course, nobody receives the email message. Any tips/suggestions as to why this is occuring?
Thanks!!!
Manuel Lemos - 2005-08-25 17:53:41 - In reply to message 3 from NoiseEee
No, it is not an array with a single string like that. It is an associative array that associates e-mail addresses to the corresponding personal names.
You can build it like this:
$recipients = array()
$recipients['peter@gabriel.org'] = 'Peter Gabriel';
$recipients['paul@simon.net'] = 'Paul Simon';
$recipients['mary@chain.com'] = 'Mary Chain';
$message_object->SetMultipleEncodedEmailHeader('To', $recipients);
Preseo - 2005-09-06 16:06:38 - In reply to message 4 from Manuel Lemos
How would I attach a wav file to the email that is being sent out.... I need to attach an actual WAV file to the email.
Thanks in advance.
Manuel Lemos - 2005-09-06 16:24:26 - In reply to message 5 from Preseo
Do you need to attach the WAV file as any other kind of attachment or embed it in an HTML message that could make it play the sound when the HTML message is displayed?
In the first case, just take a look at the test_attachment_message.php example script.
Preseo - 2005-09-06 20:37:55 - In reply to message 6 from Manuel Lemos
Will this work with sending bulk HTML mail out?
Thanks
Manuel Lemos - 2005-09-06 22:07:11 - In reply to message 7 from Preseo
Sure, there are several bulk mail examples you can learn from.
If you are not personalizing the body of the messages that you are sending to all recipients, you are strongly encouraged to set the class cache_body variable so the class does not waste time rebuilding the message to every recipient that is mailed.
Preseo - 2005-09-06 22:10:12 - In reply to message 7 from Preseo
it worked thanks
Andy Graves - 2007-09-18 08:11:41 - In reply to message 4 from Manuel Lemos
Hi Manuel
Thanks for your great email scripts - I am having a problem when using the SetMultipleEncodedEmailHeader function. When using your example of the recipients array I get the following error message:
string(95) "To: peter@gabriel.org (Peter Gabriel), paul@simon.net (Paul Simon), mary@chain.com (Mary Chain)"
I know the email addresses are guff, but I've been getting the same when using vaild email addresses. Would muchly appreciate any help!
Cheers
Andy Graves
|