Jump to content

PHP function to send email to manual email entry


slawotrend

Recommended Posts

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 by gw1500se
Link to comment
Share on other sites

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 by slawotrend
Link to comment
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.