Jump to content

mail() says it sends the mail, but its not recieved


TeddyKiller

Recommended Posts

Simple Q. Hard A.

I have a code, and a function in class Mailer. if(mail send) { success } else { not success }

Like so..

 

            if ($mailer->sendWelcome($fullname, $email, $password, $link)) {
                $_SESSION['success'] = 'You have successfully registered and an activation email has gone to your account';
                
                header("Location: /tests/index.php");
            } else {
                $_SESSION['success'] = 'Mail failed to send';
            }

and the function is simialr to as follows

    function sendWelcome($name, $email, $pass, $link) {
        if(mail($email, $subject, $mail_body, $header))
        {
            return true;
        }
        else
        {
            return false;
        }
    }

The body etc is defined inside the function...

Now, it returns the true message. 'You have successfully registered ... ' so it means the message was sent, only... nobody gets it?!

 

Any help?!

 

Thanks!

Some more info.

If I put everything from the sendWelcome into the function that calls it, it works fine.

 

I have config.php, which includes mailer.php and defines it as $mailer.

I have a process.php, which includes config, and which calls the login function in session.php. That works fine.

 

The login function has global $mailer; but that doesn't do anything. I know its bad to have globals, but im not sure how to pass it through.

 

Any help?!

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.