Karyna Posted November 29, 2012 Share Posted November 29, 2012 i have a php form that recolect data form users and send some emails... i have no problems with that, but the part is drive me crazy its that as i show in the below example of my code only the last 2 mails are sent.. the first 2 not!! i been tried no quites, single quotes, double quotes... no use the first 2 mails are not sent.. only the last 2.. whats wrong?? php mail function dont accept variable names in the '$to' parameter??... the echo lines at the end i wroted so i sure the variables have the vaue wich its true... pls.. some one help in this!! :-\ :'( TNX .blah .blah . $meil2=$_POST['meil']; $jobmeil2=$_POST['jobmeil']; .blah . mail('$meil2',"VELEC 2012, Resgister succced!","{$datav}","From: [email protected]"); mail('$jobmeil2',"VELEC 2012, Register succed!","{$datav}","From: [email protected]"); mail("[email protected]","VELEC 2012, new customer has register !","$data_cust","From: [email protected]"); mail("[email protected]","VELEC 2012, new customer has register !","$data_cust","From: [email protected]"); <?php echo $meil2; echo $jobmeil2; ?> Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/ Share on other sites More sharing options...
wigwambam Posted November 29, 2012 Share Posted November 29, 2012 Try removing the quotes: mail($meil2,"VELEC 2012, Resgister succced!","{$datav}","From: [email protected]"); mail($jobmeil2,"VELEC 2012, Register succed!","{$datav}","From: [email protected]"); Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396254 Share on other sites More sharing options...
Karyna Posted November 30, 2012 Author Share Posted November 30, 2012 :'( nop... doesnt work without quotes... what i want to do is send meil to the one in the variables meil2 and jobmeil2.. why are not send it?? Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396562 Share on other sites More sharing options...
Jessica Posted December 1, 2012 Share Posted December 1, 2012 You haven't given us enough information. Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396575 Share on other sites More sharing options...
floridaflatlander Posted December 1, 2012 Share Posted December 1, 2012 "php mail function dont accept variable names in the '$to' parameter??" Yes it does, I use it. For testing, try hard coding dummy values and/or get rid of one of the parameters. If the simple hard code works it may mean that your format is wrong. mail('$meil2',"VELEC 2012, Resgister succced! $datav","From: [email protected]"); or mail('$meil2',"Test Title", "Test Body", "From: [email protected]"); Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396637 Share on other sites More sharing options...
Christian F. Posted December 1, 2012 Share Posted December 1, 2012 floridaflatlander: Variables will not be parsed when inside single quotes, an "$meil2" is most definitely not a valid e-mail address. Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396641 Share on other sites More sharing options...
floridaflatlander Posted December 1, 2012 Share Posted December 1, 2012 floridaflatlander: Variables will not be parsed when inside single quotes, an "$meil2" is most definitely not a valid e-mail address. The single quotes may be his issue, I just copied and pasted his code, changed the title & message and did't see that. But as I under stand it, $meil2 is a variable like $to so it should be ... mail("$meil2","VELEC 2012, Resgister succced! $datav","From: [email protected]"); or mail("$meil2","Test Title", "Test Body", "From: [email protected]"); Hey Katyna, before you do all this change your code to mail("$meil2","VELEC 2012, Resgister succced!","{$datav}","From: [email protected]"); mail("$jobmeil2","VELEC 2012, Register succed!","{$datav}","From: [email protected]"); and see what happens Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396648 Share on other sites More sharing options...
Christian F. Posted December 1, 2012 Share Posted December 1, 2012 No, quotes around single variables are not necessary at all. That's the same as writing 0 + # + 0 every time you want to write a number. This is the proper way to write it: mail($meil2,"VELEC 2012, Resgister succced!",$datav,"From: [email protected]"); mail($jobmeil2,"VELEC 2012, Register succed!",$datav,"From: [email protected]"); Which is exactly what wigwambam posted in the first reply to this thread. Link to comment https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396654 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.