This extension adds email opt out option to Leads
This module manages a set of email templates that are to be sent by the vtigerCRM system at defined times or events. There are three types of automatic emails:
Each of these types can be configured to send the email template to:
The entity events (create, alter, delete and value change) can be configured to send the email immediately after the event or with a delay and on a determined schedule. The scheduled report can only be sent on a given schedule.
Most of this event checking and email sending is done by a script that must be called periodically in a cron or scheduled task. The granularity at which this script is called is important or some scheduled email may be sent more than once.
Each time the sendAutoEmails script is called it will fetch a list of pending emails to send. In the advent of retrieving a very large list (due to server downtime or a mass delete/change operation), the script will not have enough time to execute and send out all the emails before it is called again. In this case it will be possible that some emails will be sent twice or more depending on the workload and frequency at which the script is called. To avoid this situation I would recommend executing the script manually and waiting for it to end. For example, suppose we have had a few hours of downtime and we are not sure of how many pending emails are now ready to be sent. We stop the scheduled job and execute the script manually. Once it has finished all pending emails have been sent and we can activate the scheduled job once more.
In this same line I would recommend setting a frequency not to short, for example 5 minutes, which should give the script enough time to send out all it's emails. Obviously your mileage will vary depending on the amount of autoemails you activate.
Some combinations may not make much sense like sending an email to an account every minute after it has been created. But we have preferred to leave the power and flexibility in the extension instead of forcing the users to do things in a determined way that may only be cutting off possibilities we don't see at this moment.
The valid schedule types are:
Due to performance issues when using the application on a normal basis and trying to connect to an email server each time an event occurs we have decided to create a record in the database indicating that the event has occurred and an email must be sent. Then the email will be sent out the next time the scheduler is launched and will do the job in the background. Due to this, the immediate emails are really of type Reactive+2min which may find some inconsistency if a Reactive+1min email is programmed. Also due to the almost insignificant difference between Reactive+1min and immediate I would recommend not to program any Reactive+1min emails. This is also recommendable for Reactive schedules shorter than the sendAutoEmails script frequency. If the sendAutoEmails script is called once every 5 minutes, a Reactive+3min will not be sent until the next 5 minute period is over, or even worse in the case that “now”+3min falls into the “next” 5 minute period.
Some inconsistencies may occur when sending Reactive emails to deleted entities. Thanks to the fact that vtigerCRM really doesn't eliminate the deleted information, most if not all the information related to a deleted entity will exist in the moment of sending a reactive email a month after elimination. But we can't be sure that custom fields or related information will exist so these types of emails should not depend on elaborated field relation but be more in the line of simple static text.
Reactive Value-Triggered AutoEmails will only be sent the first time the criteria is true, after that the email will not be sent. This email can be forced again eliminating a record in the database or editing the autoemail and saving it again. This second method is more drastic and will activate the email for all entities that fulfill the criteria. Tweaking the database the email can be activated for only one (or various) entities.
Attachments. Any number of files can be attached to an email template. The files must be accessible by the apache user and left in a defined directory. By default this directory is /tmp, but it should be changed to a more useful (and controlled) directory. This must be done by editing the modules/Setttings/AutoEmail.php script and changing the $aeattachmentpath variable.
var $aeattachmentpath = '/tmp/'; // Must end with a slash
The email template is an HTML enabled text box in which a variety of place holders or tags can be inserted depending on the base module the template is made for
On each autoemail, except scheduled reports, you will find an “Entities Sent to” button which will give a list of entities that the email has been sent to. For every email that this extension sends to an entity in the system it also attaches a reference that will appear in the “More Information”:Email section of that entity.
⇒ Let's say I want to send out a mailing today to all my contacts whose last name's first letter is 'J'.
I would setup an autoemail like this:
|Description:||Mailing to J|
|Schedule Type||Daily, and set the time it will start|
|Email body as needed|
Once saved we wait until the selected start time arrives. The mailing will start only if the sendAutoEmail.php is called exactly at the indicated time. You can also execute this script manually at this time.
Now we must wait for the mailing to finish and deactivate or delete the autoemail or it will be sent out again tomorrow at the indicated time. Be careful!!
If our mailing only needs less than an hour to finish you could set the Schedule Type to Hourly, but be careful if you get interrupted and don't deactivate the autoemail the whole mailing will be sent again in the next hour. If our mailing takes more than one day you can do the same process but selecting the weekly or monthly schedule type. In any case remember to deactivated it.
⇒ Monthly newsletter
|Schedule Type||Monthly (indicate day and time)|
|Field Name||vtiger_contactdetails.subscribed2newsletter (cf_456)|
|Email body as needed|
sendAutoEmail.php script must be executed on the selected day and time
Some examples that come to mind:
NOTE: We could change this way of working to make it more user friendly. Contact us.
Carlo Beschi from Studiosynthesis
I created an autoemail template - type triggered value - to inform my user whenever the field “associated to product” of a trouble ticket gets modified and contains the “vtiger” string.
This can't be done easily. As stated in the documentation the current version of the module does not fetch values of other related tables when comparing value-triggered fields. So you can't access “product description” from troubleticket you can only access the product_id which is the field that is in the trouble ticket. So if you want to send an email for a subset of products you will have to play with their ID's and different autoemail definitions.
Description: email vtiger product between 6 and 14
Field: value triggered product id between 6 and 14
Description: email vtiger product 22
Field: value triggered product id equals
The body of the email will always be the same.
As with all our modules:
patch -p 0 < modules/Settings/autoemails.diff
This module is capable of sending out a very big amount of emails. You could easily be accused of spamming and breach your hosting contract. TSolucio will not take any responsibility for these actions. This module can and should be used for sending consented emails to your customers. This extension respects the opt-out fields of your leads, accounts and contacts but any mistake configuring the value-triggered emails or periodic scheduled emails can easily send out hundreds or thousands of emails.
Index: modules/Settings/AutoEmail.php =================================================================== --- modules/Settings/AutoEmail.php (revision 902) +++ modules/Settings/AutoEmail.php (working copy) @@ -431,6 +431,7 @@ $mail->Password = $mail_server_password; $mail->From = $this->getFrom(); $mail->FromName = $this->getFrom(); + if ($AcuseRecibo) $mail->ConfirmReadingTo = $mail->From; $toaddrs = $this->getTo(); $toarray = array_unique(split(',',$toaddrs));