Jump to content

Recommended Posts

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;

?>

Link to comment
https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/
Share on other sites

"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");

Link to comment
https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396637
Share on other sites

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 by floridaflatlander
Link to comment
https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396648
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/271370-php-dont-send-meils/#findComment-1396654
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.