Fork me on GitHub

Probléme with newsletter cronjob  Bottom

  • hi


    I ve got some question concerning the cronjob from the newsletter,

    do they send email to every people in the list if "number of people per request =0" ?
    is there a report or something to see if people received the newsletter ?

    it'seems the email was sent to only one person in my case,

    thanks in advanced
  • ok i managed to make it worked

    first , in the theme module, xanthia cache must not be used for newsletters

    Email are send by packets of mails, so you have to run the send task multiple times.
    As i didn't want to do it manually , i made this small script which send mail until there is no mail to send

    In order to use it , edit
    - NOTAVAILABLE : message which says there no more available email for sending newsletter, (look in you constant _NEWSLETTER_NO_USERS)
    - HOSTNAME : you hostname without
    - ADMINKEY : you admin key , look in the newsletter module interface

    Code

    #!/bin/bash
    NOTAVAILABLE="disponible pour envoyer la newsletter"
    HOSTNAME=forum.webnetters.org
    ADMINKEY=5c81d723f4

    isFinished=0
    until [ "$isFinished" == "1" ]; do
            url="http://${HOSTNAME}/index.php?module=Newsletter&func=send&scheduled=1&authKey=${ADMINKEY}"
            curl --silent ${url} --user-agent "Mozilla/5.0"  >report.txt
            isFinished=$(grep "${NOTAVAILABLE}" report.txt|wc -l)
            if [ "$isFinished" == "0" ]; then
                    sendLetters=$(sed 's/.*class=\"pn-module-Newsletter\">\([ 0-9]*\)<\/div>.*//' report.txt)
                    echo "Sending letters ... ${sendLetters} letters send [${isFinished}]"
                    sleep 60
            else
                    echo "Finish"
            fi

            rm -f report.txt
    done

This list is based on users active over the last 60 minutes.