Tracking email status - Bounced, Deferred, Over Quota, Delivered

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
Hello,

We are using postfix to relay emails to mail.google.com using our Gmail
email account. What happens is that sometimes email(s) to some of the users
never reaches. So, we got couple of questions.

1) If postfix can't send email to one email address in the list then it will
stop sending rest?

2) Is there a possibility that postfix can tell us status of every email it
sends to mail.google.com like address was incorrect, recipient's email
account quota full, Gmail also defer's emails, etc.

Appreciate your help.

Thanks & Regards,
Owais.



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Viktor Dukhovni
On Mon, Mar 30, 2020 at 11:18:47AM -0700, Owais Khan wrote:

> We are using postfix to relay emails to mail.google.com using our Gmail
> email account. What happens is that sometimes email(s) to some of the users
> never reaches. So, we got couple of questions.
>
> 1) If postfix can't send email to one email address in the list then it will
> stop sending rest?

No, and the answer is in your logs.  Of course Google may refuse to
accept some messages, for some or all recipients to which the message
was addressed.  They may also limit the "From:" address and or envelope
sender to match the login account.  Is this is a personal email account
or a Google Apps (G-Suite?) domain account?

What happens to each message (and message recipient) is not a secret,
the delivery status is recorded in your logs.

> 2) Is there a possibility that postfix can tell us status of every email it
> sends to mail.google.com like address was incorrect, recipient's email
> account quota full, Gmail also defer's emails, etc.

The answer is in your logs.

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
yes it is G-SUITE domain.

please tell me is there any way we could find out from witch id the mail is
bounced on post fix.

As i see bounced statuses and deffer-ed status but could not find the
problematic mail id.


Thanks



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
In reply to this post by Viktor Dukhovni
and is there any way i could exactly count sent mail from a particaular "from
id" other than pflogsumm utility.


Thanks



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Dominic Raferd


On Tue, 31 Mar 2020 at 08:59, Owais Khan <[hidden email]> wrote:
and is there any way i could exactly count sent mail from a particaular "from
id" other than pflogsumm utility.

To see postfix's log messages of some sort of refusal by gmail when relaying to it, use something like this:
grep "smtp\[.*said:.* - gsmtp" /var/log/mail.log
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Viktor Dukhovni
In reply to this post by Owais Khan
On Tue, Mar 31, 2020 at 12:58:56AM -0700, Owais Khan wrote:

> and is there any way i could exactly count sent mail from a particaular "from
> id" other than pflogsumm utility.

Perhaps you'll find "collate" useful:

    https://github.com/vdukhovni/postfix/tree/master/postfix/auxiliary/collate

It does often require minor adjustment to its regular expressions for
matching the initial portion of your log messages, whose format is
system-dependent:

    https://github.com/vdukhovni/postfix/blob/master/postfix/auxiliary/collate/collate.pl#L9-L12

to search for a multi-line block (delimited by blank lines) match a
particular pattern, I use:

    $ perl -ne '
        BEGIN {$/="\n\n"}
        print if m{some-perlre-pattern}
        ' [input files...  (or else stdin) ]

--
    Viktor.
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
Thank you Viktor,

I am trying to run it as below - where mylog is a sample of postfix logs but
I can't see anything dumping in a file where I can analyse.

perl collate.pl mylog

I was debugging script as well using perl -d but couldn't catch much of it.

Appreciate any help.

Thanks & Regards,
Owais.



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Wietse Venema
Owais Khan:
> Thank you Viktor,
>
> I am trying to run it as below - where mylog is a sample of postfix logs but
> I can't see anything dumping in a file where I can analyse.
>
> perl collate.pl mylog

perl collate.pl mylog > name-of-output-file

        Wietse

> I was debugging script as well using perl -d but couldn't catch much of it.
>
> Appreciate any help.
>
> Thanks & Regards,
> Owais.
>
>
>
> --
> Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
>
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
Thanks

I knew this way of redirecting output. I thought it would produce me some
statistics like bounced counts, etc.

But, it seems to bring chunks from original log. Is this the expected output
of this collate.pl?

Thanks & Regards,
Owais.



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Wietse Venema
Owais Khan:
> Thanks
>
> I knew this way of redirecting output. I thought it would produce me some
> statistics like bounced counts, etc.
>
> But, it seems to bring chunks from original log. Is this the expected output
> of this collate.pl?

Yes. The purpose of this script is to group logfile records for
the same mail delivery transaction.

This will help you to find out what happened with the messages that
are the subject of your investigation.

If the remote SMTP server accepted email, then Postfix will log
"status=sent" and the remote SMTP server response will contain an
identifier that the server's administrators can use in further
investigations.

Examples:

Apr  6 05:09:40 spike postfix/smtp[14214]: 48wl9F4n0dzJrNs: to=<[hidden email]>, relay=gmail-smtp-in.l.google.com[172.217.197.26]:25, delay=9.3, delays=6.9/0.018/1.1/1.3, dsn=2.0.0, status=sent (250 2.0.0 OK  1586164180 s21si9838137qte.81 - gsmtp)

Apr  6 09:10:04 spike postfix/smtp[17719]: 48wrVh2cdHzJrNt: to=<[hidden email]>, relay=mail.cloud9.net[2604:8d00:0:1::7]:25, delay=0.24, delays=0.13/0.026/0.068/0.016, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 8DED4336382)

If the remote SMTP server rejected email, then Postfix will log
"status=bounced" or "status=deferred" and the remote SMTP server
response will say why.

        Wietse
Reply | Threaded
Open this post in threaded view
|

Re: Tracking email status - Bounced, Deferred, Over Quota, Delivered

Owais Khan
Thank you it makes sense now.

BTW, I have tried SendMail Analyzer Script to get stats summary and it
worked for summary.

http://sareport.darold.net/index.html

Appreciate all the help you guys provided.

Thanks & Regards,
Owais.



--
Sent from: http://postfix.1071664.n5.nabble.com/Postfix-Users-f2.html