gw1500se Posted March 28, 2019 Share Posted March 28, 2019 (edited) Because you are not following directions and not RTFM. $to_email1 = trim(strip_tags($_POST['sup1'])); // supplier email on the form $to_email2 .= ','.trim(strip_tags($_POST['sup2'])); $to_email3 .= ','.trim(strip_tags($_POST['sup3'])); $to_email4 .= ','.trim(strip_tags($_POST['sup4'])); Why are you setting different variables? I said to use one. The concatenation does nothing when used with a new variable. This is what you should use: $to_email1 = trim(strip_tags($_POST['sup1'])); // supplier email on the form $to_email1 .= ','.trim(strip_tags($_POST['sup2'])); $to_email1 .= ','.trim(strip_tags($_POST['sup3'])); $to_email1 .= ','.trim(strip_tags($_POST['sup4'])); Then: $mailer = mail($to_email1, $email_subject, $email_message, $headers); Had you read the documentation you would have seen that 'mail' only takes 4 arguments. Also you did not remove the error suppression (@) as suggested by ginerjm so you are not able to see any error messages which would also have helped you figure out what is wrong. Edited March 28, 2019 by gw1500se Quote Link to comment Share on other sites More sharing options...
slawotrend Posted March 29, 2019 Author Share Posted March 29, 2019 (edited) I tried to change to this before and it didn't work, $to_email = trim(strip_tags($_POST['sup1'])); // supplier email on the form $to_email .= ','.trim(strip_tags($_POST['sup2'])); $to_email .= ','.trim(strip_tags($_POST['sup3'])); $to_email .= ','.trim(strip_tags($_POST['sup4'])); Then: $mailer = mail($to_email, $email_subject, $email_message, $headers); The code always sents one email intead of 4. Weird. Would there be possible to use array for POST and then enforce to use array in mailer? Maybe this would work. Thanks for help anyway. Edited March 29, 2019 by slawotrend Quote Link to comment Share on other sites More sharing options...
slawotrend Posted March 29, 2019 Author Share Posted March 29, 2019 I've sorted it. It works, there was an error in lower part of code that somehow prevented mailer to function properly 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.