TeddyKiller Posted June 20, 2010 Share Posted June 20, 2010 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! Link to comment https://forums.phpfreaks.com/topic/205321-mail-says-it-sends-the-mail-but-its-not-recieved/ Share on other sites More sharing options...
TeddyKiller Posted June 20, 2010 Author Share Posted June 20, 2010 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?! Link to comment https://forums.phpfreaks.com/topic/205321-mail-says-it-sends-the-mail-but-its-not-recieved/#findComment-1074632 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.