Destramic Posted November 15, 2014 Share Posted November 15, 2014 hey guys im using phpmailer (https://github.com/PHPMailer/PHPMailer) to send mail from my server to users using SMTP...the problem im getting is that when i send a mail it goes stright into the junk mail...how can i please stop this please? $mail = new \Mail\Mail; $mail->isSMTP(); $mail->Debugoutput = 'html'; $mail->Host = "****"; $mail->Port = 25; $mail->SMTPAuth = true; $mail->Username = "****"; $mail->Password = "***"; $mail->setFrom('***', '****'); $mail->addAddress('email@hotmail.co.uk', 'user'); $mail->Subject = 'BiSi - Welcome'; $mail->msgHTML('<a href="test">hello</a>'); $mail->AltBody = "This is the body in plain text for non-HTML mail clients"; if (!$mail->send()) { echo "Mailer Error: "; } else { echo "Message sent!"; } Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/ Share on other sites More sharing options...
tryingtolearn Posted November 15, 2014 Share Posted November 15, 2014 Check the headers on the message and take a look at Return Path: From: are they the same domain names or different? Also What does it say by Received-SPF Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496691 Share on other sites More sharing options...
tryingtolearn Posted November 15, 2014 Share Posted November 15, 2014 if you try using mail() does it give the same result? Here is a basic example from the manual. (Just change the $to and header addresses ) <?php $to = 'nobody@example.com'; $subject = 'the subject'; $message = 'hello'; $headers = 'From: webmaster@example.com' . "\r\n" . 'Reply-To: webmaster@example.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); mail($to, $subject, $message, $headers); ?> Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496695 Share on other sites More sharing options...
Destramic Posted November 16, 2014 Author Share Posted November 16, 2014 Check the headers on the message and take a look at Return Path: From: are they the same domain names or different? Also What does it say by Received-SPF I have the same retrun and from path, not sure what you mean about recieved-SPF but here is the the output im getting when i send the email. Thank you Connection: opening to bisi.bid:25, t=300, opt=array () Connection: opened SERVER -> CLIENT: 220 rlinux20.grserver.gr ESMTP Postfix CLIENT -> SERVER: EHLO bisi.bid SERVER -> CLIENT: 250-rlinux20.grserver.gr250-PIPELINING250-SIZE 16777216250-ETRN250-STARTTLS250-AUTH PLAIN DIGEST-MD5 LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN CLIENT -> SERVER: STARTTLS SERVER -> CLIENT: 220 2.0.0 Ready to start TLS CLIENT -> SERVER: EHLO bisi.bid SERVER -> CLIENT: 250-rlinux20.grserver.gr250-PIPELINING250-SIZE 16777216250-ETRN250-AUTH PLAIN DIGEST-MD5 LOGIN CRAM-MD5250-ENHANCEDSTATUSCODES250-8BITMIME250 DSN CLIENT -> SERVER: AUTH LOGIN SERVER -> CLIENT: 334 VXNlcm5hbWU6 CLIENT -> SERVER: bm9yZXBseUBiaXNpLmJpZA== SERVER -> CLIENT: 334 UGFzc3dvcmQ6 CLIENT -> SERVER: YTFfQ3MzZzg= SERVER -> CLIENT: 235 2.7.0 Authentication successful CLIENT -> SERVER: MAIL FROM:<noreply@bisi.bid> SERVER -> CLIENT: 250 2.1.0 Ok CLIENT -> SERVER: RCPT TO:<ricky.powell@hotmail.co.uk> SERVER -> CLIENT: 250 2.1.5 Ok CLIENT -> SERVER: DATA SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF> CLIENT -> SERVER: Date: Sun, 16 Nov 2014 14:54:53 +0200 CLIENT -> SERVER: To: Ricky Powell <ricky.powell@hotmail.co.uk> CLIENT -> SERVER: From: "BiSi.bid" <noreply@bisi.bid> CLIENT -> SERVER: Reply-To: First Last <noreply@bisi.bid> CLIENT -> SERVER: Subject: BiSi - Welcome Ricky CLIENT -> SERVER: Message-ID: <78fd33649e5c92f3ac6b165de1090274@bisi.bid> CLIENT -> SERVER: X-Priority: 3 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.9 (https://github.com/PHPMailer/PHPMailer/) CLIENT -> SERVER: Organization: Sender Organization CLIENT -> SERVER: MIME-Version: 1.0 CLIENT -> SERVER: Content-type: text/plain; charset=iso-8859-1 CLIENT -> SERVER: X-Priority: 3 CLIENT -> SERVER: X-Mailer: PHP5.5.12 CLIENT -> SERVER: MIME-Version: 1.0 CLIENT -> SERVER: Content-Type: multipart/alternative; CLIENT -> SERVER: boundary="b1_78fd33649e5c92f3ac6b165de1090274" CLIENT -> SERVER: Content-Transfer-Encoding: 8bit CLIENT -> SERVER: CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274 CLIENT -> SERVER: Content-Type: text/plain; charset=us-ascii CLIENT -> SERVER: CLIENT -> SERVER: This is the body in plain text for non-HTML mail clients CLIENT -> SERVER: CLIENT -> SERVER: CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274 CLIENT -> SERVER: Content-Type: text/html; charset=us-ascii CLIENT -> SERVER: CLIENT -> SERVER: welcome to bisi. really glad you regustered CLIENT -> SERVER: CLIENT -> SERVER: CLIENT -> SERVER: CLIENT -> SERVER: --b1_78fd33649e5c92f3ac6b165de1090274-- CLIENT -> SERVER: CLIENT -> SERVER: . SERVER -> CLIENT: 250 2.0.0 Ok: queued as 9759916E448A CLIENT -> SERVER: QUIT SERVER -> CLIENT: 221 2.0.0 Bye Connection: closed Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496719 Share on other sites More sharing options...
tryingtolearn Posted November 16, 2014 Share Posted November 16, 2014 did you try the example I posted in #3 above? What was the result from that? did it get delivered or sent to junk mail? Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496721 Share on other sites More sharing options...
Destramic Posted November 16, 2014 Author Share Posted November 16, 2014 ummm im not usinfg a mail function...im connection to my stmp server and sending it from there Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496739 Share on other sites More sharing options...
tryingtolearn Posted November 16, 2014 Share Posted November 16, 2014 Yes I can see that. Lots of factors will play in your mail getting sent to a junk folder, most of which are out of your control. Just wanted to see if you got the same result with a basic mail() setup. You know - sort of like a place to start trying to track down a problem. Maybe your server is blacklisted Maybe your ip is blacklisted Maybe its a dynamic ip address Could be a problem with the DNS record etc... You can read about spf records in cpanel under email authentication. Quote Link to comment https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496743 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.