PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 5:39 am
Code: Select all
<?php
/* recipients */
$to = "email1@hotmail.com" . ", ", ", ", ", " ; // note the comma
$to .= "email2@hotmail.com";
$to .= "email3@hotmail.com";
$to .= "email4@hotmail.com";
$to .= "email5@hotmail.com";
$to .= "email6@hotmail.com";
/* subject */
$subject = ":: SHUT UP EMAIL ::";
/* message */
$message = '
<html>
<body>
<p>This Email Has Been Sent From 8th-Dimension . Net from people that hate you.</p>
</body>
</html>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: email <email@hotmail.com\r\n";
$headers .= "From: Mail() PHP Script <rubbish@8th-dimension.net>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
?>
<font color="FF0000">Thank You! Your Email has been sent 5 times to
emails@hotmail.com </font>
Theres something wrong with:
Code: Select all
<?php
$to = "email1@hotmail.com" . ", ", ", ", ", " ; // note the comma
?>...
Whats wrong with the commas?[/php_man]
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 5:41 am
Code: Select all
<?php
$to = "email1@hotmail.com" . ", " . ", " . ", " . ", " . ", " ; // note the comma
?>
EDIT: hmmmm.... still doesnt work.. but it doesnt show any parse error..
i think it does send... but not to all the 6 emails...
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Thu Dec 11, 2003 5:47 am
The output of:
Code: Select all
$to = "email1@hotmail.com" . ", " . ", " . ", " . ", " . ", " ;
$to .= "email2@hotmail.com";
$to .= "email3@hotmail.com";
$to .= "email4@hotmail.com";
$to .= "email5@hotmail.com";
$to .= "email6@hotmail.com";
echo $to;
is
Code: Select all
email1@hotmail.com, , , , , email2@hotmail.comemail3@hotmail.comemail4@hotmail.comemail5@hotmail.comemail6@hotmail.com
Maybe this is more what you are looking for:
Code: Select all
$to = array();
$to[] = "email1@hotmail.com";
$to[] = "email2@hotmail.com";
$to[] = "email3@hotmail.com";
$to[] = "email4@hotmail.com";
$to[] = "email5@hotmail.com";
$to[] = "email6@hotmail.com";
$to = implode('; ', $to);
echo $to;
Code: Select all
email1@hotmail.com; email2@hotmail.com; email3@hotmail.com; email4@hotmail.com; email5@hotmail.com; email6@hotmail.com
Mac
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 5:56 am
its just meant to send it to every one of those emails each time the script is executed.. thats all...
its just weird how it doesnt send to all the 6 emails listed there..
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 6:03 am
Code: Select all
$to = array();
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to = implode('; ', $to);
Doesn't even send 1 email..
Nay
Forum Regular
Posts: 951 Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia
Post
by Nay » Thu Dec 11, 2003 6:06 am
I think it was supposed to be more of:
-Nay
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 6:14 am
lol, still nothing.. this is odd..
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 6:18 am
AnsonM wrote: Code: Select all
<?php
$to = "email1@hotmail.com" . ", " ; // note the comma
$to .= "email1@hotmail.com";
?>
Thats the original... It says note the comma..hmmm...
But I need to add more emails to send it to... so i have to add more lines of:
but i dont know what to do with the adding of the commas..
JayBird
Admin
Posts: 4524 Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:
Post
by JayBird » Thu Dec 11, 2003 6:22 am
can you echo the $o variable to see what it contains
Mark
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 1:58 pm
Code: Select all
<?php
email1@hotmail.com;email2@hotmail.com;email3@hotmail.com;email4@hotmail.com;email5@hotmail.com;email6@hotmail.com
?>
it doesnt send...
how does PHP want the format of the emails to be like??
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Thu Dec 11, 2003 2:03 pm
Code: Select all
<?php
/* recipients */
$to = array();
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to[] = "sshh_d0nt_tell@hotmail.com";
$to = implode("; ", $to);
/* subject */
$subject = ":: SHUT UP EMAIL ::";
/* message */
$message = '
<html>
<body>
<p>This Email Has Been Sent From 8th-Dimension . Net from people that hate you.</p>
</body>
</html>
';
/* To send HTML mail, you can set the Content-type header. */
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
/* additional headers */
$headers .= "To: Some1 <email@hotmail.com\r\n";
$headers .= "From: Mail() PHP Script <rubbish@8th-dimension.net>\r\n";
/* and now mail it */
mail($to, $subject, $message, $headers);
?>
<font color="FF0000">Thank You! Your Email has been sent 5 times to sshh_d0nt_tell@hotmail.com</font>
Thats the whole thing..
Replace those emails with yours, and test out the script.... it doesnt work...
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Fri Dec 12, 2003 2:32 am
Did you try it with:
instead of
so that you have a comma instead of a semi-colon, sorry I should have checked the manual before posting:
http://php.net/manual/en/function.mail.php
PHP Manual - mail() wrote: Multiple recipients can be specified by putting a comma between each address in to.
If that still doesn't work, have you tried taking out this line:
Code: Select all
$headers .= "To: Some1 <email@hotmail.com\r\n";
and if it's still not working, you may have to loop the e-mail sending script 5 times to get the desired effect.
Mac
AnsonM
Forum Commoner
Posts: 72 Joined: Thu Sep 25, 2003 7:21 am
Post
by AnsonM » Fri Dec 12, 2003 6:29 am
I've tried all that..... and it doesnt ive an error.. but it doesnt work still...
I don't know how to loop it
twigletmac
Her Royal Site Adminness
Posts: 5371 Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK
Post
by twigletmac » Fri Dec 12, 2003 6:53 am
Can you send a simple email:
Code: Select all
mail('yourname@youremailhost.com', 'testing e-mail sending', 'just testing this works');
Mac