Okay
  Public Ticket #3758382
Scheduled notifications cron job
Closed

Comments

  •  1
    Eline Tibboel started the conversation

    Hi! Can you help me with the following? 

    I've been setting up scheduled notifications. I sent the cron job to the hosting company after talking to them about it. 

    */15 * * * * https://dekeramiekfabriek.nl/wp-admin/admin-ajax.php?action=wpamelia_api&call=/notifications/scheduled/send

    The Hosting company implemented the cron job, and I did some testing - Set the notifications on 1 hour before the event, created events and subscribed to them. 

    Unfortunately, no scheduled notifications are coming in. The other notifications are being sent all right. (confirmation of subscribing etc)

    The hosting company assured me that the cron job is copy-pasted alright and it's on the right place. 

    I also checked the settings in Amelia. 

    The mail notifications are set on PHP because hosting company says their servers are set up for it. Still, the scheduled messages are not being sent.

    Hopefully you can help me find a solution.

    Thanks,

    Eline

  •  1,559
    Uroš replied

    Hello Eline,

    Thank you for reaching out to us.

    Please note: We strongly recommend changing mail service setting to SMTP because email that is sent with PHP Mail generally gets flagged as spam by mail servers and also can take some time to send. See below how to configure SMTP mail services.

    • SMTP (Simple Mail Transfer Protocol) – In this article, we show how to configure the SMTP mail service for Gmail, but you can set it up for any other outgoing service that supports SMTP for a mail client. When you select this option, four inputs will appear – you need to populate them to configure SMTP properly. A Google SMTP example:
      • SMTP Host – smtp.gmail.com
      • SMTP Port – 587
      • SMTP Secure – TLS
      • SMTP Username – Your Gmail address
      • SMTP Password – Your App password (details about setting up an app password can be found in the yellow notice section below)

      The most commonly used SMTP Ports are 465 and 587. Port 465 uses “SSL” as SMTP Secure, while port 587 uses “TLS” as SMTP Secure. Make sure to check what the correct SMTP settings are for your mailing provider.

     

    Google SMTP (Gmail accounts):

    From 30 May 2022, Google will no longer support the use of third-party apps or devices which ask you to sign in to your Google Account using only your username and password, so “Allow less secure apps” will be removed.

    In order to continue using SMTP with Gmail, you will need to set up an App Password for Amelia. App Passwords can only be used with accounts that have 2-Step Verification turned on. Instructions about this can be found on Google’s Documentation, here.

    For detailed set-up instructions, please take a look at this article on our official support platform.

    Microsoft SMTP (outlook, hotmail, live, and office365 email accounts):

    If you’re having issues using SMTP with your Microsoft account, please make sure to set up an App Password for Amelia. App Passwords can only be used with accounts that have 2-Step Verification turned on in the Security Basics section of your Microsoft account. Instructions about this can be found on Microsoft’s Documentation, here.

    For detailed set-up instructions, please take a look at this article on our official support platform.

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Eline Tibboel replied privately
  •  1,559
    Uroš replied

    Hello Eline,

    Here is what I would suggest, instead of the cronjob being set up on the server, you can set it up via WP Crontrol.

    WP Crontrol plugin is the best option for configuring cron jobs. You can find more info about it, and detailed instructions on how to set it up in our FAQ section.

    So, if you already read that, and still need some clarification here's some further info.

    You copy only the URL from below a scheduled notification:

    7810032183.png

    Then, go to Tools/Cron Events, and click on the "Cron Schedules" tab. In it, add a 15-minute interval:

    2487877415.png

    Then go back to the "Cron Events" tab and click on "Add new":

    9085918175.png

    Below it, select the "PHP Cron event" radio button, and add the URL you copied from Amelia/Notifications in this form:

    file_get_contents("yourURL");
    2095163400.png

    Below it add the name and set it to run a few minutes in the future, using the provided time format. So, if you're adding the cron event at 12:45 (local, current time), set it to run at 12:50; and then select the schedule you previously selected:

    7642938415.png

    Click on Add Event, and that's it.

    The cron runs every 15 minutes and checks if there's an email to be sent. So, in Amelia Notifications, your scheduled notifications are set to run every day at a certain time. If you set that time to be 15:00 (for example), the emails will be sent when the cron runs after that time.

    For example, there's an appointment booked for tomorrow, and it's currently 14:44 - the cron runs, but since it's not yet 15:00, it doesn't send anything. It runs again after 15 minutes, so at 14:59, but there are still no emails flagged by Amelia, so it doesn't send anything. Then it runs again at 15:14 and it sees there's an email that should've been sent at 15:00, so it sends the email. It will only send emails when Amelia sees an appointment scheduled for the next day.

    I hope that helps.

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •   Eline Tibboel replied privately
  •  1,559
    Uroš replied

    Hello Eline,

    Thank you for the update on this.

    The cron job configured for Amelia (with the WP Crontrol plugin) is set to run every 15 minutes:

    1152545805.png

    Amelia doesn't have any impact on cron jobs - they are performed and executed by WP Crontrol, or command on your server. As previously explained, if you set the time for the reminder email to go out at 08:00, the task won't be scheduled before then, so if a cron job runs at 07:59:59, there won't be a scheduled task for it to run, but instead, it will check if there's a task in the next recurrence (in your current setup - 15 minutes later, so at 08:14:59). This is when the email will be sent. It can also be delayed, but that also doesn't and cannot be influenced by Amelia. The email is prepared and scheduled to run at any point after 08:00 when the cron runs, but delays can be caused by multiple things which are related to email providers, spam checkers, security measures, etc. We generally do not recommend PHP Mail (which is what you currently have active) because they can be flagged for SPAM. Since you say emails do go through, their delay (if not caused by the recurrence of cron jobs) can be caused by spam and virus checkers flagged by the usage of PHP Mailer.

    I suppose you changed the recurrence from 1 minute to "every 15 minutes", or you've mistaken the cron seen above Amelia cron in the screenshot above, but your current setup shows that the cron for Amelia doesn't run every minute.

    As for a 24h scheduled reminder, you can add that too by clicking on the "Create New Notification" button in the list of available Notification templates. Then, you can add a scheduled notification that will run for one, multiple, or all services 24 hours before the appointment:

    8226270135.png

    Again, this doesn't trigger the email exactly 24 hours before the appointment is scheduled, but instead activates a scheduled task 24 hours before the appointment starts. This means that the next cron recurrence will trigger the notification, so it's recommended to set the recurrence (Event Schedule) to run every minute. You may also experience delays due to the limitations mentioned above, but if there are no spam checks, virus checks, or security measures in place, you should see a delay no more than 1 minute.

     

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables

  •  1
    Eline Tibboel replied

    Hi Uros,

    Thanks  for your explanation. 

    Sorry, I wasn't clear and caused confusion, but after your advise I changed to the SMTP setup and was delighted that the notifications were sent. But issues remained. So, I followed your advice and implemented Crontrol and set the cron job to 1 minute. Now it works. So, thanks! 

    A problem with the scheduled notifications you can create yourself is that you have to assign them to specific events. This for sure is not going to work for my clients. They will forget and it's prone to mistakes. A better way for Amelia could be to make it the other way around: all events are selected, the organiser can uncheck the events he does not want to include.

    Anyway, cron job fixed. Thanks!

    Eline

  •  1,559
    Uroš replied

    Hello Eline,

    Thank you for your detailed feedback and thoughtful suggestion! We're glad to hear that the cron job fix worked and that the SMTP setup resolved the notification issue. We truly appreciate you taking the time to share your experience with us.

    We understand your concern regarding the need to assign notifications to specific events. Your suggestion to have all events selected by default, with the option to uncheck those that don’t need to be included, is a great idea. We'll definitely take it into consideration as we continue to improve Amelia.

    If you need any further assistance or have more suggestions in the future, please don’t hesitate to reach out. Your input helps us enhance the product, and we’re always here to help!

    Kind Regards, 

    Uros Jovanovic
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps, and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables