Automated email cakephp 3.x - email

I am trying to develop a system which allows the user to enter a date and time. Then at entered time the system send an email to the user. I already have the system. All I am looking for is a way to send emails at a given time. I can send emails but cannot programme them to be sent on a precise date and time. Can you help me please? Thanks in advance.

This problem could be solves by using a "cron job" that checks at some interval whether there's any emails to be send now.
You could simply make a single Cake Shell (http://book.cakephp.org/3.0/en/console-and-shells.html) and use some built-in task runner (eg. cron on linux) - but you could also use a plugin for this principle and have that part set up for you.
For a quick'n'easy plugin that works for lots of sites: https://github.com/dereuromark/cakephp-queue.
The functionality you're asking is even built into this plugin already! :)
You'll have got create a class like this: https://github.com/dereuromark/cakephp-queue/blob/master/src/Shell/Task/QueueExampleTask.php#L74 and then just create a new job of this task and set the notbefore parameter to the time you want this email to be sent.
Check the readme here: https://github.com/dereuromark/cakephp-queue/tree/master/docs.
Remark: The email will be sent when the worker executes the given task, so it will be x time after the notbefore property, depending on your amount of workers and jobs - and how long time they'll take to execute.

Related

power shell file not created

my need is that I have an interface that drops files regularly into a specific directory. I need to monitor this directory to make sure the interface is still functional. I must be notified by e-mail if there is no new file created for more than one specific time (x hours). I need a script powershell that can notify me in this specific case.
You need to have some Cron Job Schedule that will send you the email by checking the status of you conditions.
Link below will help you.
https://technet.microsoft.com/en-us/library/jj649816(v=wps.630).aspx
Thanks

Suitescript - nlapiSendEmail() - Can I delay an email through script to send on certain date?

I currently have a script that triggers on save that sends out an email. However, under certain criteria, I would like to still trigger the script on save but delay the email until a certain date. Is this possible? How would that be written?
You might want to you NetSuite Workflow. You can put the record in a workflow state based on you condition. On that workflow state have a delay transition to another state after x days which will send the email.
Look at the SuiteAnswer for drop marketing for sample workflows.
#scheppsr77's answer is a good idea.
Another way to do it would be to create a new custom record type that holds the email information and the date you want to send it on. Then have a script that runs periodically checking for any emails to send. Basically it could run like a cron job. I've done that before, for certain items that needed to be re-run or needed to delay.

SugarCrm - How to send e-mail to manager every time a Lead is updated?

I'm new to SugarCRM.
I've google but I can't find a solution for this. Every time a Lead is UPDATED (New Log Call, New Email Attached, New meeting, Status Change) I need to send an e-mail.
How can I do this in SugarCrm?
Best Regards,
André
While the benefits of blasting a person with an email upon every update can be argued against, what you will need to do is use an after_save logic hook on the Leads module. Within that hook you would then send an email if it is an existing lead.
Helpful links:
http://support.sugarcrm.com/02_Documentation/04_Sugar_Developer/Sugar_Developer_Guide_7.6/60_Logic_Hooks/20_Module_Hooks/after_save/
http://developer.sugarcrm.com/2011/02/14/howto-detect-record-state-in-a-logic-hook/
http://developer.sugarcrm.com/2011/03/01/howto-send-an-email-inside-sugar-thru-code/
If you are using professional version you need to create a workflow and customize the email template (everything using sugar interface in admin panel).
If you are using the community version you need to create logic hooks file and create you logic manually. I suggest you create one $old_lead in before save hook and compare this $old_lead with actual $bean and see if have one changes.

How to handle large amounts of scheduled tasks on a web server?

I'm developing a website (using a LAMP stack) which must handle many user-made scheduling tasks. It works as following: an user creates an event and sets a date, and others users (as many as 63) may join. A few hours before the set date, the system must email each user subscribed to that event. And that's it.
However, I have never handled scheduling, and the only tools I know (poorly) are cron and at. My plan is to create an at job for each event, which will call a script that gets all subscribers emails and mails them.
My question is: is my plan/design good? Is it scalable? Are there better options that I should be aware of?
Why a separate cron job for each event? I've done something similar thing for a newsletter with a cron job just running once per hour and if there are any newsletters to be sent it just handles them. In your case you'd have a script that runs once every hour and gets a list of users for events that happen in the desired time interval since.
It will work. As far as scalability, at the minimum make sure that the script runs in it's own process so it doesn't bog down the server unnecessarily.
Create a php-cli script perhaps?
I'm doing most of my work in Rails nowadays, and there's a wealth of background processing libraries one of them is Resque it uses the redis server to keep track of the jobs
I found a PHP clone https://github.com/chrisboulton/php-resque
Might be overkill for your use case, but give it a shot perhaps
If you would consider a proper framework that uses an application server (and not a simple webserver), Spring has a task scheduling layer that's simple to use. Scheduling jobs on the server really requires more than what a simple LAMP install can do, but I haven't used PHP in a while so maybe there's an equivalent.
Here's an article that compares some of your options.

Possible to delay email sending in Jenkins?

Due to high network traffic during the day, many of our Jenkins builds must run in evenings and during the night. Emails are sent containing reports, notifications of broken builds, etc. However, I don't want the emails to be sent to developers in evenings and during the night. Is it possible to queue all the emails and send them e.g. between 8-17 office hours? So if a build breaks during the night, an email is sent at 8am.
Unfortunately, as far as I know, there is no plugin that allows to delay email sending. However, maybe you can give a try to the script capability of the email-ext plugin. It allows you to use JS or Groovy scripts in the template. In such script, you may write a loop that "waits" 8am to send the email.
But personnally, I don't like that idea, it's not really a good way to achieve that, and in addition it will certainly make the final result of the build wait until 8am (the build will only finish once the mail is effectively sent). This will also have the drawback that the job will take one place in the Jenkins job queue, potentially blocking another job...
Maybe developing your own plugin (by forking mail-ext plugin for example) would be a better idea...
Let me spread my ideas.
I'm also not aware of any existing functionality to achieve that via Jenkins.
Plugin would be probably the best way (possibly beneficial for others is published to public).
The alternative solution coming to my mind is in case you are in a situation, where you have control of the e-mail server, that might also be place to achieve your goal.
As for the SMTP (based on the sever you use) there might be a solution.
Possibly solution provided here (sendmail in queue-only mode) could help you:
How can I delay mail delivery through an SMTP relay, possibly sendmail