bumpn Posted May 2, 2013 Share Posted May 2, 2013 This mailer works with go daddy but I cant get it too work with a home server. It will send the mail and shows up in the inbox but not the content. I think it has to do with using $body tag but I am not sure any suggestions? <?php // PHPmailer settings $mail = new PHPMailer(); // create a new object $mail->Issmtp(); // enable SMTP $mail->SMTPDebug = 1; // debugging: 1 = errors and messages, 2 = messages only $mail->SMTPAuth = true; // authentication enabled $mail->SMTPSecure = 'ssl'; // secure transfer enabled REQUIRED for GMail $mail->Host = 'smtp.gmail.com'; $mail->Port = 465; $mail->Username = "email"; // SMTP username $mail->Password = "password"; // SMTP password $mail->From = $email; $mail->FromName = $contact_name; $mail->SetFrom($email, $contact_name); $mail->AddAddress('email'); $mail->Priority = 1; $mail->WordWrap = 50; // set word wrap $mail->IsHTML(true); // send as HTML $mail->Subject = "Gray Gables maintenance request"; $mail->Body = $body; $mail->AltBody = "This is the text-only body"; // gets info from form $name = $_POST['name'] ; $email = $_POST['email'] ; $phone = $_POST['phone'] ; $message = $_POST['message'] ; $ip = $_SERVER['REMOTE_ADDR']; // defines how message looks in email $mail->Body=" Name: $name<br> Telephone: $phone<br> Email: $email<br> IP address: $ip <br> -------------------<br> Message:<br> $message"; // looks good in your inbox $mail->From = "$email"; $mail->FromName = "$name"; $mail->AddReplyTo("$email","$name"); // gives success or error if(!$mail->Send()) { echo 'Message could not be sent.'; echo 'Mailer Error: ' . $mail->ErrorInfo; exit; } echo ' <meta http-equiv="refresh" content="3;url=http/"> <center><font size="5px"> Message has been sent!!<br> you will be redirected to our home page in 3 seconds...<br> <a href="http">click here</a> to return now. </font> </center> '; ?> <?php echo ' Client IP: '; if ( isset($_SERVER["REMOTE_ADDR"]) ) { echo '' . $_SERVER["REMOTE_ADDR"] . ' '; } else if ( isset($_SERVER["HTTP_X_FORWARDED_FOR"]) ) { echo '' . $_SERVER["HTTP_X_FORWARDED_FOR"] . ' '; } else if ( isset($_SERVER["HTTP_CLIENT_IP"]) ) { echo '' . $_SERVER["HTTP_CLIENT_IP"] . ' '; } ?> Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 2, 2013 Share Posted May 2, 2013 Do you have a mail server running on the local machine? Quote Link to comment Share on other sites More sharing options...
oaass Posted May 3, 2013 Share Posted May 3, 2013 jazzman1, no need for a mail server on localhost when using the gmail smtp bumpn, Before you send the mail, var_dump the $mail->Body variable.. Quote Link to comment Share on other sites More sharing options...
DaveyK Posted May 3, 2013 Share Posted May 3, 2013 Also, it MIGHT actually send it but your inbox might just now show it. Quote Link to comment Share on other sites More sharing options...
jazzman1 Posted May 3, 2013 Share Posted May 3, 2013 jazzman1, no need for a mail server on localhost when using the gmail smtp Agreed......my fault Quote Link to comment Share on other sites More sharing options...
bumpn Posted May 3, 2013 Author Share Posted May 3, 2013 sry i mean when i say home server is its a server that is hosted in someones home. not my actually machine or my house Quote Link to comment 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.