Welcome Guest, Not a member yet? Register   Sign In
Send e-mail from form to random people
#1

[eluser]Elias Rufino[/eluser]
Hello again.

Is there a way to send an e-mail from a form, but when I have a list of two or three people, to random this 3 e-mail address and send it to just one of those 3 peoples?

I need to send it to a fix e-mail address too, so, I need to random and I have one more address that can not be random, this person must receive the e-mail, doesn't matter who was random in addiction to it.

I would like to thank you in advance,


Elias
#2

[eluser]Elias Rufino[/eluser]
Hello guys. I solved it just using PHP, and here is the way I used:

Code:
<?php
// my list of emails
$my_array = array("[email protected]", "[email protected]", "[email protected]");
        for ($i=0; $i<=10; $i++)
        {
            $random = array_rand($my_array);
            $rand_mail = $my_array[$random];
        }

// my fixed mail
$fixed_mail = "[email protected]";

$send_to = $fixed_mail.", ".$rand_mail;


echo $send_to;
?&gt;

Thank you for the attention, hope this can help someone too.



Elias
#3

[eluser]Elias Rufino[/eluser]
Guys, when I tried this code I posted, it worked great.

But now, I'm using this in the controller, and there are errors there.
Could someone please help me how to put it inside a controller?


Thanks,

Elias




Theme © iAndrew 2016 - Forum software by © MyBB