nathanmaxsonadil Posted July 27, 2007 Share Posted July 27, 2007 My mailer does not work Can you see what's the matter with it? Mailer.php <? /** * 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 = "My Site - Welcome!"; $body = $user.",\n\n" ."Welcome! You've just registered at My Site " ."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" ."- My Site 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 = "My Site - 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" ."- My Site team"; return mail($email,$subject,$body,$from); } }; /* Initialize mailer object */ $mailer = new Mailer; ?> Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/ Share on other sites More sharing options...
nathanmaxsonadil Posted July 27, 2007 Author Share Posted July 27, 2007 Is there any problem with the code listed? Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-308989 Share on other sites More sharing options...
clanstyles Posted July 27, 2007 Share Posted July 27, 2007 what doesn't work? It doesn't send the mail? Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-308993 Share on other sites More sharing options...
nathanmaxsonadil Posted July 27, 2007 Author Share Posted July 27, 2007 yes Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-308994 Share on other sites More sharing options...
clanstyles Posted July 27, 2007 Share Posted July 27, 2007 EMAIL_FROM_ADDR EMAIL_FROM_NAME You might want to put some information in there.. Lets start with that. Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-308997 Share on other sites More sharing options...
kiss-o-matic Posted July 27, 2007 Share Posted July 27, 2007 Do you have access to the system logs of your machine? tail /var/log/httpd (assuming you're running apache) and see what it says. I just had the issue where my smtp server uses a nonstandard port (standard is 25). Probably would've never caught it had I not see it complain in the log. The following fixed it. $mail->Host = "my.smtp.host:port"; Also, for testing you should use the very simple example code that comes w/ the package. Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-309001 Share on other sites More sharing options...
nathanmaxsonadil Posted July 27, 2007 Author Share Posted July 27, 2007 It's already done here /** * Email Constants - these specify what goes in * the from field in the emails that the script * sends to users, and whether to send a * welcome email to newly registered users. */ define("EMAIL_FROM_NAME", "noreply"); define("EMAIL_FROM_ADDR", "[email protected]"); define("EMAIL_WELCOME", "true"); Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-309004 Share on other sites More sharing options...
nathanmaxsonadil Posted July 27, 2007 Author Share Posted July 27, 2007 I dont know how to do that from cPanel Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-309006 Share on other sites More sharing options...
nathanmaxsonadil Posted July 27, 2007 Author Share Posted July 27, 2007 Is this a problem with my hosting ??? Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-309015 Share on other sites More sharing options...
kiss-o-matic Posted July 27, 2007 Share Posted July 27, 2007 Possibly. You might want to ask them. YOu should really try the demo code in the package install though. http://phpmailer.sourceforge.net/ Link to comment https://forums.phpfreaks.com/topic/62063-php-mailer/#findComment-309025 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.