Cron job sends duplicate e-mails

Discussion in 'General' started by ayok, Sep 17, 2012.

  1. ayok

    ayok New Member

    Hi,
    I am a PHP programmer but not really good with linux programming. So please be patient with me. I am busy now with a site which needs to work with the cron job. The admin panel of the server is ISPConfig 3.0.4.6. So that's why I am trying to find help here.

    The cron job is working well, it executes every task with just this command:
    Code:
    * * * * * http://www.site.com/emails.php
    However, when I tried to setup cron job to execute a script which sends emails, it sends me duplicate emails. So instead of receiving one emails I could receive 2 - 3 emails which is unexpected.

    I have report this with the system administrator, but he ignores me, instead he accuse me that the mistake lays on the script. I have assured him that there is nothing wrong with the script because I've tested it with simple PHP mail(). Now the project stucks with this problem. And he, of course, is very busy with other things.

    So, could someone please help me here? Thank you in advanced.

    Greetings,
    ayok
     
  2. ayok

    ayok New Member

    Has nobody ever used ispconfig cron job for mailinglist??
     
  3. falko

    falko Super Moderator Howtoforge Staff Moderator HowtoForge Supporter ISPConfig Developer

    Do you have root access to the server? If so, what's in the mail log when the script is called?

    Do you have the same problem when you call the script in a browser?
     
  4. ayok

    ayok New Member

    Hi. Thanks for the reply.
    Yes I have the root access to mail log, I see my e-mail is called two times. But I don't really understand what causes it. And I don't really know how to analyse it.

    What I got is:
    Code:
    postfix/smtp[1883]: EFE3D2C01DA: to=<my email>, relay= 127.bla bla, delay=4, delays= and so on.
    postfix/qmgr[2916]: EFE3D2C01DA: removed
    postfix/smtp[3593]: 6F97C2C01D3: to=<my email>, relay= xx.xchg01.blabla, delay=4, delays= and so on.
    postfix/qmgr[2916]: 6F97C2C01D3: removed
    Then again
    Code:
    postfix/smtp[1883]: 2D7122C0164: to=<my email>, relay= 127.bla bla, delay=4, delays= and so on.
    postfix/qmgr[2916]: 2D7122C0164: removed
    postfix/smtp[3652]: 0F8A32C01D3: to=<my email>, relay= xx.xchg01.blabla, delay=4, delays= and so on.
    postfix/qmgr[2916]: 0F8A32C01D3: removed
    I have tested in browser and it gave me different result. In IE and firefox, it sends once, but in chrome it sends two times.
     
  5. pititis

    pititis Member

    Check the message headers for both emails, the answer is there.
     
  6. ayok

    ayok New Member

    Thanks!
    I have tested 2 different emails, both are duplicated, but have different header.

    The first one,
    Code:
    amavis[26497]: (26497-03) Passed BAD-HEADER, <web@server> -> <my email>, quarantine: U/badh-Uo+mu32fsdf, Message-ID: <msg id>, mail_id: etc..
    The other one, looks better but still duplicated
    Code:
    amavis[27881]: (27881-08-2) Passed CLEAN, <no-reply@yoursite.com> ->, Message-ID: <msg id> etc...
    I still don't see the cause, and don't know the solution.

    Btw, how can I copy the line?
     
    Last edited: Sep 19, 2012
  7. pititis

    pititis Member

    Hello,

    Your script is using a bad/missing header to send email and amavis tagged it as quarantine . It passes CLEAN because in your spam filter policy is defined so (check your policy). After the email is tagged an email is send to the quarantine admin (with information about the bad headers).


    - Google the problem with de bad headers (you will find tons of info)
    - If you want, you can tunning your amavis setting.

    Cheers
     
: cronjob, email

Share This Page