liuch / dmarc-srg

A php parser, viewer and summary report generator for incoming DMARC reports.
GNU General Public License v3.0
228 stars 34 forks source link

SMTP reading is not working #15

Closed nasirmgcc closed 2 years ago

nasirmgcc commented 2 years ago

on Justhost server the smtp reading reports from email not working.

liuch commented 2 years ago

Hello nasirmgcc, I need more information to understand this issue. What exactly doesn't work? Which mistakes do you have? What version of php is installed on your server? Are all needed php modules installed?

nasirmgcc commented 2 years ago

I have updated all the necessary scripts changes for SMTP, when i am trying to see request to pull email , it taking too long and end-up with unreachable .

liuch commented 2 years ago

SMTP is for sending emails not for receiving them. This project uses IMAP for this. Are there other tools or applications on your server that successfully use IMAP for the same mailbox?

nasirmgcc commented 2 years ago

Yes, I am using GMail IMAP

nasirmgcc commented 2 years ago

it might be the blockage on the Hosting provider Firewall? is firewall of the Host can block PHP not to connect with GMail IMAP? the IMAP is enabled from Gmail and less security app is too.

liuch commented 2 years ago

Yes, it could be one of your hosting provider's firewall rules, but I have never run into that. You can check it out by yourself using this command on your server (you must have openssl installed): openssl s_client -crlf -connect imap.gmail.com:993

Note that you should use imap.gmail.com as the host name, not just gmai.com!

nasirmgcc commented 2 years ago

Yes,i am trying now on my localhost, thank you " imap.gmail.com " i know abou this. let me try on localhost

liuch commented 2 years ago

BTW, this config works well for me:


    'name'     => 'Gmail',
    'host'     => 'imap.gmail.com',
    'username' => 'user@gmail.com',
    'password' => 'password',
    'mailbox'  => 'INBOX',
    'encryption' => 'ssl'
nasirmgcc commented 2 years ago

Thank you for the sharing, Yes, these are also correct only missing was 'encryption' => 'ssl' i added an retested,

The error i am receiving:

Can't connect to imap.gmail.com,143: Network is unreachable

liuch commented 2 years ago

It looks like you have a blockage with reject rule or you have some kind of network problem.

nasirmgcc commented 2 years ago

This is received on the localhost i fixed with enabling with imap extension loaded Uncaught Error: Call to undefined function Liuch\DmarcSrg\Mail\imap_open()

nasirmgcc commented 2 years ago

{"error_code":-1,"message":"Can't connect to imap.gmail.com,143: Timed out"} with debug code on my localhost i got this

liuch commented 2 years ago

Can't connect to imap.gmail.com,143

You must not connect to port 143 (IMAP), you must connect to port 993 (IMAPS). Have you specified 'encryption' => 'ssl' in the config file?

nasirmgcc commented 2 years ago

Can't connect to imap.gmail.com,143: Timed out

nasirmgcc commented 2 years ago

$mailboxes = [ // Just for displaying in web-admin. Not necessary. 'name' => 'Gmail', // Host of the email server. You can specify a port separated by a colon. 'host' => 'imap.gmail.com', // Connection encryption method. The valid values are: // 'none' - without encryption (strongly not recommend). // 'ssl' - SSl/TLS on a separate port, for IMAP it is usually port 993. // 'starttls' - STARTTLS method, usually on the standard IMAP port 143. Default value. 'encryption' => 'ssl', // Set true if you want to connect to the IMAP server without certificate validation 'novalidate-cert' => true, 'port' => 993,//465, // Mailbox user name. 'username' => 'dmarc.mgcc@gmail.com', // Mailbox password. 'password' => 'PASSWORD', // Mailbox name 'mailbox' => 'INBOX' ];

nasirmgcc commented 2 years ago

i tried both : 'novalidate-cert' => true, 'novalidate-cert' => false,

no successs

liuch commented 2 years ago

Hello, nasirmgcc. I just pasted your config 'AS IS' into my conf.php on my localhost and got this: Can not authenticate to IMAP server: [AUTHENTICATIONFAILED] Invalid credentials (Failure) (of course I don't know the correct password) so it works for me.

Have you tried the command I mentioned above? What did it say?

p.s. There is no option port in the conf.php, your option has no effect. If you want to specify a different port number you must use the option host this way: imap.gmail.com:999 but it is not necessary in this case.

nasirmgcc commented 2 years ago

I don't know what i am doing wrong or why not working for me, if you dont' mind you can help me with i just created an email dmarc.analyzar@gmail.com Password: *****

I tested with, the results are same, can you test it and share with me the Copy you are using, and i can test here, because i tested my Firewall , etc everything is open.

nasirmgcc commented 2 years ago

App Password: *****

nasirmgcc commented 2 years ago

I created a simple php script and tested it's workign fine with App Passoword but now Dmarc script is replying too many failure requests. :( imap.gmail.com:993/imap/ssl/novalidate-cert

nasirmgcc commented 2 years ago

Finally worked 👍

liuch commented 2 years ago

I'm glad it finally worked! p.s. I have replaced the passwords with asterisks.