Jump to content

PHP Email Code


Guest

Recommended Posts

The attached code works except the email portion. This code allows a user to upload a file(s) to a network share & has a few check mark boxs for John Doe & Jane Doe. If the box for John or Jane is checked it is suppose to send them an email once submit is pressed but the email does not get sent. Can someone help me out on this? Thanks

17405_.txt

Link to comment
https://forums.phpfreaks.com/topic/255597-php-email-code/
Share on other sites

you havn't really given us much to work with.  Does mail() work at all form your site? have you tried assigning (join(', ', $destination) to a variable and then echoing it to make sure that the content is accurate? have you tried capturing any failure of mail() in that script?

Link to comment
https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310338
Share on other sites

If I put just this code:

 

<?php
if (isset($_POST['formsent'])) {
  $destination = array();
  if (!empty($_POST['notify_jane'])) $destination[] = [email protected];
  if (!empty($_POST['notify_john'])) $destination[] = [email protected];
  if ($destination) {
    mail(join(', ', $destination), 'Notification', 'Hey there');
  }
} else {
?>
<form action="<?=$_SERVER['PHP_SELF']?>" method="post">
  <input type="hidden" name="formsent" value="true" />
        <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_jane" value="yes" /> to send <strong>John Doe</strong> a notification.
        <br/>Check this box <input autocomplete="off" type="checkbox" name="notify_john" value="yes" /> to send <strong>Jane Doe</strong> a notification.
        <input type="submit" value="Submit" />
        </form>
<?php
}

 

 

I still does not work & I get the URL below in the browser...thanks to any help provided.

 

 

http://myserver/flow/%3C?=$_SERVER['PHP_SELF']?>

Link to comment
https://forums.phpfreaks.com/topic/255597-php-email-code/#findComment-1310354
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.