Jump to content

phpmailer


Destramic

Recommended Posts

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 protected]', '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!";
}
Link to comment
https://forums.phpfreaks.com/topic/292489-phpmailer/
Share on other sites

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      = '[email protected]';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: [email protected]' . "\r\n" .
    'Reply-To: [email protected]' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
?>
Link to comment
https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496695
Share on other sites

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:<[email protected]>

SERVER -> CLIENT: 250 2.1.0 Ok

CLIENT -> SERVER: RCPT TO:<[email protected]>

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 <[email protected]>

CLIENT -> SERVER: From: "BiSi.bid" <[email protected]>

CLIENT -> SERVER: Reply-To: First Last <[email protected]>

CLIENT -> SERVER: Subject: BiSi - Welcome Ricky

CLIENT -> SERVER: Message-ID: <[email protected]>

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

Link to comment
https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496719
Share on other sites

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.

Link to comment
https://forums.phpfreaks.com/topic/292489-phpmailer/#findComment-1496743
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.