Login   Register  
PHP Classes
elePHPant
Icontem

HTML message sent to multiple recipient, only with email address

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us

      MIME E-mail message sending  >  All threads  >  HTML message sent to multiple recipient, only with email address  >  (Un) Subscribe thread alerts  
Subject:HTML message sent to multiple recipient, only with email address
Summary:Sending HTML message to multiple user, only with email address
Messages:8
Author:Guillaume Lambert
Date:2005-09-27 18:21:01
Update:2005-09-28 19:35:36
 

  1. HTML message sent to multiple recipient, only with email address   Reply   Report abuse  
Picture of Guillaume Lambert
Guillaume Lambert
2005-09-27 18:21:01
Hi!

I've been trying to send HTML message in the form of "send to a friend". The user enter 1-5 email address and it sends them a HTML message. Is it possible to send with your class, only with email adresses and not names?

Thank you

Guillaume
Revolver
www.revolver3.com

  2. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Guillaume Lambert
Guillaume Lambert
2005-09-27 18:39:41 - In reply to message 1 from Guillaume Lambert
Oh, and I want them to receive individual emails. Meaning I don't want them to see the other email addresses its being sent to, is that possible?

Thank you!

My email is guillaume.lambert@revolver3.com, if you could send the awnser there, it would be extremely appreciated

Guillaume

  3. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Guillaume Lambert
Guillaume Lambert
2005-09-27 18:43:49 - In reply to message 2 from Guillaume Lambert
And while we're at it, in hotmail, the message goes directly into my junkmail box. Here's the code, if that can help :

--

$recipients = '';

// Email to send to
if ($_POST['email1'] != '') { $recipients[$_POST['email1']] = 'Équita'; }
if ($_POST['email2'] != '') { $recipients[$_POST['email2']] = 'Équita'; }
if ($_POST['email3'] != '') { $recipients[$_POST['email3']] = 'Équita'; }
if ($_POST['email4'] != '') { $recipients[$_POST['email4']] = 'Équita'; }
if ($_POST['email5'] != '') { $recipients[$_POST['email5']] = 'Équita'; }

// Message
$body = '<html><body bgcolor="#ffffff"><div align="center"><a href="http://www.equita.qc.ca/riz/"><img src="http://www.equita.qc.ca/riz/images/oxfam_email.jpg" width="600" height="400" border="0" alt=""></a></div></body></html>';

$from_address='info@commerceequitable.com';
$from_name='Équita';
$reply_name=$from_name;
$reply_address=$from_address;
$reply_address=$from_address;
$error_delivery_name=$from_name;
$error_delivery_address=$from_address;

$subject="Une invitation spéciale d'Équita";
$email_message=new email_message_class;
$email_message->SetMultipleEncodedEmailHeader('To', $recipients);

$email_message->SetEncodedEmailHeader("From",$from_address,$from_name);
$email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
$email_message->SetHeader("Sender",$from_address);

if(defined("PHP_OS") && strcmp(substr(PHP_OS,0,3),"WIN")) { $email_message->SetHeader("Return-Path",$error_delivery_address); }

$email_message->SetEncodedHeader("Subject",$subject);
$html_message = '<html><body bgcolor="#ffffff"><div align="center"><a href="http://www.equita.qc.ca/riz/"><img src="http://www.equita.qc.ca/riz/images/oxfam_email.jpg" width="600" height="400" border="0" alt=""></a></div></body></html>';
$email_message->CreateQuotedPrintableHTMLPart($html_message,"",$html_part);

$text_message="Le riz équitable arrive au Québec !\n\nLe 16 octobre prochain, entre 11h et 15h, venez célébrer le lancement de notre nouveau riz équitable à la Place centrale du Marché Jean-Talon. Joignez-vous à nous pour des dégustations uniques préparées par Josée di Stasio et plusieurs chefs réputés de Montréal.\n\nPour visionnez le clip promotionnel, veuillez visiter le http://www.equita.qc.ca/riz/";
$email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part);

$alternative_parts=array(
$text_part,
$html_part
);
$email_message->AddAlternativeMultipart($alternative_parts);

$error=$email_message->Send();
if (strcmp($error,"")) {
echo "Error: $error\n";
} else {
echo "Message sent\n";
}

--

Thanks!

  4. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2005-09-28 01:53:05 - In reply to message 1 from Guillaume Lambert
Sure. Just use the function SetHeader("To", "email@adress.com"); and send different messages for each user.

  5. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2005-09-28 02:12:49 - In reply to message 3 from Guillaume Lambert
I am not sure but the message may be going to the junk folder in Hotmail because you are setting the page body background color. Try using a page wide table to set the body background color.

Another possibility may be the fact that you are setting to many recipients for the same message. Try sending separate messages for each recipient.

  6. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Guillaume Lambert
Guillaume Lambert
2005-09-28 16:13:45 - In reply to message 5 from Manuel Lemos
Thanks for the reply!

The SetHeader("to", email) works great, thanks!

But for the hotmail junk folder, it's still not working. I'm now sending the email individually, and I removed the bgcolor in the body. Also tried removing the link and nothing seems to work. My junk folder is set to highest tho, but i'm sure it can work!

Here's my newest code :

--

$recipients = '';

// Email to send to
if ($_POST['email1'] != '') { $recipients[] = $_POST['email1']; }
if ($_POST['email2'] != '') { $recipients[] = $_POST['email2']; }
if ($_POST['email3'] != '') { $recipients[] = $_POST['email3']; }
if ($_POST['email4'] != '') { $recipients[] = $_POST['email4']; }
if ($_POST['email5'] != '') { $recipients[] = $_POST['email5']; }

// Message
$html_message = '<html>
<body>
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<tr>
<td align="center" bgcolor="#FFFFFF"><img src="http://www.equita.qc.ca/riz/images/oxfam_email.jpg" width="600" height="400" border="0" alt=""></td>
</tr>
</table>
</body>
</html>';

$from_address = 'info@commerceequitable.com';
$from_name = 'Équita';
$reply_name = $from_name;
$reply_address = $from_address;
$reply_address = $from_address;
$error_delivery_name = $from_name;
$error_delivery_address = $from_address;

// Send individual email to each recipients
for ($i = 0; $i < count($recipients); $i++) {

$subject = "Une invitation spéciale d'Équita";
$email_message = new email_message_class;
$email_message->SetHeader("To", $recipients[$i]); $email_message->SetEncodedEmailHeader("From",$from_address,$from_name); $email_message->SetEncodedEmailHeader("Reply-To",$reply_address,$reply_name);
$email_message->SetHeader("Sender",$from_address);

if(defined("PHP_OS") && strcmp(substr(PHP_OS,0,3),"WIN")) { $email_message->SetHeader("Return-Path",$error_delivery_address); }

$email_message->SetEncodedHeader("Subject",$subject);
$email_message->CreateQuotedPrintableHTMLPart($html_message,"",$html_part);

$text_message="Le riz équitable arrive au Québec !\n\nLe 16 octobre prochain, entre 11h et 15h, venez célébrer le lancement de notre nouveau riz équitable à la Place centrale du Marché Jean-Talon. Joignez-vous à nous pour des dégustations uniques préparées par Josée di Stasio et plusieurs chefs réputés de Montréal.\n\nPour visionnez le clip promotionnel, veuillez visiter le http://www.equita.qc.ca/riz/";
$email_message->CreateQuotedPrintableTextPart($email_message->WrapText($text_message),"",$text_part);

$alternative_parts=array(
$text_part,
$html_part
);
$email_message->AddAlternativeMultipart($alternative_parts);

$error=$email_message->Send();
if (strcmp($error,"")) {
echo "Error: $error\n";
} else {
echo "Message sent\n";
}

}

  7. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Manuel Lemos
Manuel Lemos
2005-09-28 18:45:20 - In reply to message 6 from Guillaume Lambert
It seems that Hotmail does not like your HTML. It seems that it may be for not having any real text or using a large remote image.

Anyway, I replaced your HTML by this one that is almost what is used in the test_html_mail_message.php example and it was well accepted.

$html_message="<html>
<head>
<title>Une invitation spéciale d'Équita</title>
<style type=\"text/css\"><!--
body { color: black ; font-family: arial, helvetica, sans-serif ; background-color: #A3C5CC }
A:link, A:visited, A:active { text-decoration: underline }
--></style>
</head>
<body>
<table bgcolor=\"#A3C5CC\" width=\"100%\">
<tr>
<td>
<center><h1>Une invitation spéciale d'Équita</h1></center>
<hr>
<P>Hello Manuel,<br><br>
This message is just to let you know that the <a href=\"http://www.phpclasses.org/mimemessage\">MIME E-mail message composing and sending PHP class</a> is working as expected.<br><br>
Thank you,<br>
Manuel Lemos</p>
</td>
</tr>
</table>
</body>
</html>";

I suggest that you go on error and trial to add and remove HTML bits until you figure what is the problem. Just let me know what you find out.

  8. Re: HTML message sent to multiple recipient, only with email add   Reply   Report abuse  
Picture of Guillaume Lambert
Guillaume Lambert
2005-09-28 19:35:36 - In reply to message 7 from Manuel Lemos
Thank you, adding text did the trick!

Really appreciate your support

Take care

Guillaume