nathanmaxsonadil Posted July 30, 2007 Share Posted July 30, 2007 I can get this php mailer to work! it wont send me the email here is the code <? /** * Mailer.php * * The Mailer class is meant to simplify the task of sending * emails to users. Note: this email system will not work * if your server is not setup to send mail. * * If you are running Windows and want a mail server, check * out this website to see a list of freeware programs: * <http://www.snapfiles.com/freeware/server/fwmailserver.html> * * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC) * Last Updated: August 19, 2004 */ class Mailer { /** * sendWelcome - Sends a welcome message to the newly * registered user, also supplying the username and * password. */ function sendWelcome($user, $email, $pass){ $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; $subject = "Swap Invites - Welcome!"; $body = $user.",\n\n" ."Welcome! You've just registered at Swap Invites " ."with the following information:\n\n" ."Username: ".$user."\n" ."Password: ".$pass."\n\n" ."If you ever lose or forget your password, a new " ."password will be generated for you and sent to this " ."email address, if you would like to change your " ."email address you can do so by going to the " ."My Account page after signing in.\n\n" ."- Swap Invites team"; return mail($email,$subject,$body,$from); } /** * sendNewPass - Sends the newly generated password * to the user's email address that was specified at * sign-up. */ function sendNewPass($user, $email, $pass){ $from = "From: ".EMAIL_FROM_NAME." <".EMAIL_FROM_ADDR.">"; $subject = "Swap Invites - Your new password"; $body = $user.",\n\n" ."We've generated a new password for you at your " ."request, you can use this new password with your " ."username to log in to Swap Invites.\n\n" ."Username: ".$user."\n" ."New Password: ".$pass."\n\n" ."It is recommended that you change your password " ."to something that is easier to remember, which " ."can be done by going to the My Account page " ."after signing in.\n\n" ."- Swap Invites team"; return mail($email,$subject,$body,$from); } }; /* Initialize mailer object */ $mailer = new Mailer; ?> Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/ Share on other sites More sharing options...
gabrielkolbe Posted July 30, 2007 Share Posted July 30, 2007 Here's one that works..... class email { var $to; var $subject; var $body; var $from; function validateEmail($testemail){ $regexp ="^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$"; if (eregi($regexp, $testemail)){return true;} else { return false;} } function sendMail( $to, $subject, $body, $from ) { $headers = "MIME-Version: 1.0\r\n"; $headers .= "Content-type: text/html; charset=iso-8859-1\r\n"; $headers .= "Content-Transfer-Encoding: 7bit\r\n"; $headers = "From: {$from} \r\n"; if ($this->validateEmail($to) == false) {$error = "email address {$to} is an invalid";} else { if ($this->validateEmail($from) == false) {$error = "email address {$from} is an invalid";} else { $body=stripslashes($body); $subject=stripslashes($subject); if (mail ($to, $subject, $body, $headers)) {$message = "Email {$subject} was send"; } else { $error = "There was an error in sending an email to {$to}"; } } } } } Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311441 Share on other sites More sharing options...
nathanmaxsonadil Posted July 30, 2007 Author Share Posted July 30, 2007 That wont work with the script I'm using Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311449 Share on other sites More sharing options...
hitman6003 Posted July 31, 2007 Share Posted July 31, 2007 I can't get it to work That doesn't help at all. What error are you getting, if any? Is error reporting turned on? What level of errors are displayed? If necessary, turn error reporting on and increase the error reporting level: ini_set("display_errors", 1); error_reporting(E_ALL); Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311495 Share on other sites More sharing options...
nathanmaxsonadil Posted July 31, 2007 Author Share Posted July 31, 2007 It does not display any error's where would i put ini_set("display_errors", 1); error_reporting(E_ALL);? Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311499 Share on other sites More sharing options...
hitman6003 Posted July 31, 2007 Share Posted July 31, 2007 at the top, just below your the opening php tag. Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311505 Share on other sites More sharing options...
nathanmaxsonadil Posted July 31, 2007 Author Share Posted July 31, 2007 It still does not display any error's Quote Link to comment https://forums.phpfreaks.com/topic/62574-php-mailer/#findComment-311510 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.