The following warnings occurred:
Warning [2] Undefined variable $unreadreports - Line: 26 - File: global.php(961) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/global.php(961) : eval()'d code 26 errorHandler->error
/global.php 961 eval
/showthread.php 28 require_once





× This forum is read only. As of July 23, 2019, the UserSpice forums have been closed. To receive support, please join our Discord by clicking here. Thank you!

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
sending email to a user
#8
Hey,

I cannot seem to get that sending an email to a user right.
I'm using this form:

<pre>
Code:
<?php
        if (isset($_POST["submit"])) {

        $name = $_POST['name'];
        $email = $_POST['email'];
        $message = $_POST['message'];
        $human = intval($_POST['human']);
        $from = $user->data()->email['email'];
        $to = $thatUser->email;
        $subject = 'Message from Local Positivity Finder';
        
        $body ="From: $name\n E-Mail: $email\n Message: $message\n";

        // Check if name has been entered
        if (!$_POST['name']) {
            $errName = 'Please enter your name';
        }
        
        // Check if email has been entered and is valid
        if (!$_POST['email'] || !filter_var($_POST['email'], FILTER_VALIDATE_EMAIL)) {
            $errEmail = 'Please enter a valid email address';
        }
        
        //Check if message has been entered
        if (!$_POST['message']) {
            $errMessage = 'Please enter your message';
        }
        //Check if simple anti-bot test is correct
        if ($human !== 5) {
            $errHuman = 'Your anti-spam is incorrect';
        }
        
        // If there are no errors, send the email
        if (!$errName && !$errEmail && !$errMessage && !$errHuman) {
        if (mail ($to, $subject, $body)) {
            Redirect::to($us_url_root.'users/contact_success.php');
        } else {
            Redirect::to($us_url_root.'users/contact_error.php');
        }
        }
}

?>
</pre>


Any idea what im doing wrong?
  Reply


Messages In This Thread
sending email to a user - by LBC - 11-21-2016, 08:49 AM
sending email to a user - by mudmin - 11-21-2016, 04:54 PM
sending email to a user - by LBC - 11-21-2016, 05:21 PM
sending email to a user - by mudmin - 11-21-2016, 07:23 PM
sending email to a user - by plb - 11-22-2016, 05:32 AM
sending email to a user - by LBC - 11-22-2016, 06:52 AM
sending email to a user - by mudmin - 11-22-2016, 07:17 AM
sending email to a user - by LBC - 11-23-2016, 09:09 AM
sending email to a user - by mudmin - 11-24-2016, 04:20 PM
sending email to a user - by mudmin - 11-24-2016, 04:48 PM
sending email to a user - by LBC - 11-25-2016, 06:46 AM
sending email to a user - by mudmin - 11-25-2016, 01:55 PM
sending email to a user - by mudmin - 11-25-2016, 02:47 PM
sending email to a user - by LBC - 11-29-2016, 07:05 AM
sending email to a user - by LBC - 01-09-2017, 09:31 AM
sending email to a user - by LBC - 01-09-2017, 10:36 AM
sending email to a user - by LBC - 01-09-2017, 11:45 AM
sending email to a user - by mudmin - 01-11-2017, 12:28 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)