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: info@velec.com"); mail('$jobmeil2',"VELEC 2012, Register succed!","{$datav}","From: info@velec.com"); mail("george.scott@stet.com","VELEC 2012, new customer has register !","$data_cust","From: info@velec.com"); mail("support@stet.com","VELEC 2012, new customer has register !","$data_cust","From: info@velec.com"); <?php echo $meil2; echo $jobmeil2; ?> Quote Link to comment 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: info@velec.com"); mail($jobmeil2,"VELEC 2012, Register succed!","{$datav}","From: info@velec.com"); Quote Link to comment 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?? Quote Link to comment Share on other sites More sharing options...
Jessica Posted December 1, 2012 Share Posted December 1, 2012 You haven't given us enough information. Quote Link to comment 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: info@velec.com"); or mail('$meil2',"Test Title", "Test Body", "From: info@velec.com"); Quote Link to comment Share on other sites More sharing options...
Christian F. Posted December 1, 2012 Share Posted December 1, 2012 (edited) floridaflatlander: Variables will not be parsed when inside single quotes, an "$meil2" is most definitely not a valid e-mail address. Edited December 1, 2012 by Christian F. Quote Link to comment Share on other sites More sharing options...
floridaflatlander Posted December 1, 2012 Share Posted December 1, 2012 (edited) 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: info@velec.com"); or mail("$meil2","Test Title", "Test Body", "From: info@velec.com"); Hey Katyna, before you do all this change your code to mail("$meil2","VELEC 2012, Resgister succced!","{$datav}","From: info@velec.com"); mail("$jobmeil2","VELEC 2012, Register succed!","{$datav}","From: info@velec.com"); and see what happens Edited December 1, 2012 by floridaflatlander Quote Link to comment 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: info@velec.com"); mail($jobmeil2,"VELEC 2012, Register succed!",$datav,"From: info@velec.com"); Which is exactly what wigwambam posted in the first reply to this thread. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.