Jump to content

Recommended Posts

[code]<?php
$receivers = array("addy1@domain.com","addy2@domain.com","addy3@some_domain.com","addy4@another_domain.com"); // as many as you want
$to = $receivers[rand(0,count($receivers)-1)]; // a random address

... more of your code

// mail($to, $subject, $message, $headers);
?>[/code]
Link to comment
https://forums.phpfreaks.com/topic/14634-random-email-in-php/#findComment-58263
Share on other sites


what have i done wrong heres the error please help using mt_rand.

Warning: mt_rand() expects parameter 2 to be long, array given in

<?
$a=array("john@john.com","lucy@lucy.com","kevin@kevin.com","dad@dad.com","mum@mum.com");

shuffle($a);

$r=mt_rand(1,$a);

for($i=0; $i<count($r); $i++) {

echo $r[$i];
}
?>
Link to comment
https://forums.phpfreaks.com/topic/14634-random-email-in-php/#findComment-58269
Share on other sites

Thank you andy i got this together and understand it cheers.

<?
$a=array("john@john.com","lucy@lucy.com","kevin@kevin.com","dad@dad.com","mum@mum.com","stop")

;

shuffle($a);

for($i=5; $i<count($a); $i++) {

echo $a[$i];


if($a[$i]=="stop"){

echo "<br><b>Refresh agin you have seen our five email address ok!</b>";
exit;
}
}
?>
Link to comment
https://forums.phpfreaks.com/topic/14634-random-email-in-php/#findComment-58284
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.