0

I have problem with sending mail to gmail acc, IF im sending to outlook account im getting fine latter and its not junk. enter image description here

so if in this line im write $mail->AddAddress gmail account something like what test@gmail.com. I dont get any latter's, but if im writing outlook account, im getting mail like photo bellow

My code in PHPMailer

require 'PHPMailer/PHPMailerAutoload.php';

$mail = new PHPMailer;

$mail->SMTPDebug = 3;                               // Enable verbose debug output

$mail->isSMTP();                              // Set mailer to use SMTP
$mail->Host = 'mail.sssss.lt';  // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                               // Enable SMTP authentication
$mail->Username = 'noreply@sssss.lt';                 // SMTP username
$mail->Password = 'q8sAFF3S';                           // SMTP password
$mail->SMTPSecure = 'tls';                            // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;                                    // TCP port to connect to
$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);

$mail->From = "noreply@sssss.lt";               
$mail->FromName = "Patvirtinimo laiskas <noreply@sssss.lt>";            
$mail->AddAddress ("sssss@gmail.com");
$mail->AddReplyTo = "noreply@sssss.lt";     
$mail->WordWrap = 50;


$mail->isHTML(false);                                  // Set email format to HTML

$mail->Subject = 'Here is the subject';
$mail->Body    = 'This is the HTML message body <b>in bold!</b>';
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
    echo 'Message could not be sent.';
    echo 'Mailer Error: ' . $mail->ErrorInfo;
} else {
    echo 'Message has been sent';
}

All help will be appreciated

Kalakutas
  • 124
  • 2
  • 15
  • Take a look at https://stackoverflow.com/questions/9988325/everytime-my-mail-goes-to-spam-in-phpmailer – Vincenzo Manto Oct 23 '20 at 10:54
  • I have look it before, than i post my question,i try use smtp like you see in my exmaples. Maybe you can give me example by mine situation? Please – Kalakutas Oct 23 '20 at 11:03
  • 1
    Is your problem about spam or no-delivery through PHPMailer? – Vincenzo Manto Oct 23 '20 at 11:06
  • yes, and i try to solve it in different ways. if in PHPMailer i add ```$mail->isSMTP(); ``` im getting error ```Connection failed. Error #2: stream_socket_enable_crypto(): SSL operation failed with code 1. OpenSSL Error messages:error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed``` – Kalakutas Oct 23 '20 at 11:15
  • Read the PHPMailer troubleshooting guide, and also the [PHPMailer wiki article about avoiding spam filters](https://github.com/PHPMailer/PHPMailer/wiki/Improving-delivery-rates,-avoiding-spam-filters). – Synchro Oct 23 '20 at 11:54
  • Put that error message into your question, not the comments. It's significant. Maybe if you added that detail before it would not have been marked duplicate, because there would have been a specific problem to solve, instead of just "my email doesn't work" – ADyson Oct 23 '20 at 12:55
  • This error dont change anything. with some code i solve it. Im speciffic my problem. Write a lot of examples what im try, write and flask (python) code who working well with my smtp server. pearMail, phpMailer and t.t – Kalakutas Oct 23 '20 at 13:15
  • So what output do you get when you run the code, then? Does it say the mail has been sent, or not? We need to understand if the issue is that the mail isn't being _sent_ or that it just isn't being _delivered_. You haven't even given that info, so no, your question is not very specific yet. – ADyson Oct 23 '20 at 13:25
  • im edit my question, idk how to clear say it, if i send mail to google (gmail) user dont get latter, if user using like outlook, he will get the latter like my picture bellow ( and its not junk mail) – Kalakutas Oct 23 '20 at 13:32
  • You could make it clearer by answering the simple question I asked. It's up to you though. There are plenty of other questions people can choose to try and help with instead. – ADyson Oct 23 '20 at 14:01
  • @ADyson, im getting "Message has been sent ?>" and if my email in outlook im getting, if in gmail im not. its clear? – Kalakutas Oct 26 '20 at 10:01
  • Yes, thanks. That means more than likely your code is not specifically at fault. Maybe gmail blocks your sending domain or something. Have you tried whitelisting the sending address in gmail (see http://onlinegroups.net/blog/2014/02/25/how-to-whitelist-an-email-address/)? Have you tried sending to other email providers and see if it's received? A sample of 2 is very narrow. – ADyson Oct 26 '20 at 10:11
  • @ADyson , i think what too, but then i try write code in python. I use same smtp server, and i received what message. Then i try use another domain and create smtp mail from it, but still dont get any latter in gmail mail. :/ – Kalakutas Oct 26 '20 at 14:01
  • Well then what difference was there in the python code - what was different about the message you generated? You probably need to sniff the network traffic (e.g. using wireshark) and see what's different in the final generated mail data being sent to the SMTP server, between the PHP and python versions. – ADyson Oct 26 '20 at 14:10
  • Also did you do what I suggested and whitelist the address in gmail? Did that make any difference? – ADyson Oct 26 '20 at 14:10

0 Answers0