PHPmailer list from mysql, not sending to all - mysql

I am running a PHPmailer Send() from a list of 600+ members but only a selected few receive the email anything from 40 to 100 and the selection is random throughout the database
I presume it has something to do with PHPmailer not keeping up with the speed of requests
On each 'for' I reset the 'to' with ClearAddresses(), the body is less than 100 words and no attachments
Any ideas

Use Thread or give some sleep time

Did your hostingprovider regulate the Mail-traffic?
In other way, you can replace the mail() function with an Array. At the end of the script, you can print_r($Array); and you can validate your loops.

Related

How do I reduce the number of characters in an input string/varchar in MySQL

I basically have two tables tbl_feedback and tbl_notification that both get values inserted in them through a stored procedure whenever a person submits a feedback.
What I'm aiming for is getting a "shortened" version of a message column inserted into tbl_notification (say 60 characters max) so a notification only shows a preview of the actual message.
Is this possible using a MySQL function or do I have to resort to handling it via PHP (shortening an output string before echoing it)
The LEFT function was what I was looking for. Thanks, Paul.
I wish that google pointed me straight to this function.
w3resource on LEFT function

Sending mail to 100 users using SSIS mail task

I have to send mails to 100 people by using SSIS send mail task. but in SSIS mail box To address text box is having 255 characters limit where it's not allowing me to do. So could you please suggest the best way to achieve this..?
Something like this:
First task (GetUnsentEmail(s)) to select Email address (stored in a table) where 'flag' = 0 and puts those records into an object variable.
The Foreach Loop Container loops through each record in that object variable and:
puts values into variables
executes the task "Send Mail Task" which uses those variables to
send the email
executes the sql task "Update send email table" which sets 'flag' to 1
I hope this help.

ABOUT: Tutorial: Sending emails from a Spreadsheet

Is it possible to get this script updated? In 2009 it may have worked, but it doesn't now.
Tutorial: Sending emails from a Spreadsheet -
Quick link to Google Developers Tutorial
I can't for the life of me get my own script to work. Having a problem incrementing the rows correctly when it checks before sending, which is either leaving me sending a dozen e-mails of a single row of data or if I try to implement a while loop, I've ended up sending myself over hundreds of e-mails and google then stops me from using the function any further until the next day.
My specific script question is HERE, except I don't think I worded it correctly because no one is replying.
It seems that you forgot a couple of things in your script :
1° : var dataRange = sheet.getRange(sRow,1,1,cols); // this gets only 1 row in your sheet so it is normal that the loop doesn't work (length=1).
I'd suggest to replace the height value by the last row value (see docs to get that value) to make the loop iterate through every rows.
2° when you use .setValue(EMAIL_SENT); the value of EMAIL_SENT is not defined in your code (it is defined outside the function in the tutorial).
I'd suggest to add a statement like this : var EMAIL_SENT="EMAIL_SENT" or, more simply use the string value in your 'setValue' statement like this : .setValue("EMAIL_SENT");

Send Mail Task based on output from Execute SQL Task

How to send an email based on the ouput from the execute SQL Task in SSIS? If the query returns any results I would like to send an email if not the email should not be sent.
Do you want to send the results of the query in the mail or not?
Either way, you can do this:
Capture the number of rows returned by your query in a variable
Use an expression in your precedence constraint to send the email only if the rowcount was greater than zero
If you want the results of the query in the email, then the simplest thing is probably to write them to a flat file and then send the file as an attachment.
Alternatively, do the whole thing in a stored procedure using sp_send_dbmail and just call the procedure from your package.
It's probably a bit clunky, but you could send the results of your Execute SQL task to a variable, then use a For Loop container based on that variable. Put the Send Mail task within that For Loop container. The challange in that is only running the Send Mail once, no matter if the count is 1 or more. If your count was saved as a bool, perhaps that would work?
You could put another step in between, put in a Script Task that takes the count and returns a 0 or 1, and then use the For Loop with the Send Mail task within.
Like I said, clunky.

Send email to dynamic recipient SSIS Send Mail Task

I have an SSIS package which is going to be deployed on test, staging, and finally production.
It has a couple of "Send Mail Tasks",say 10.
As developer, I put my email address as the recipient of the email.
Currently, for the test person, I need to change all the "To"s in all the script task to e.g. "TestPerson#test.com". If following the paradigm of hard-coding the emails this way,I need to change the recipient email 30 times!!! (10 for each stage stated above)
Just wondering if there is any way to inject To field(recipient) dynamically. e.g. from a variable. like I have done for the "MessageSource"
You can set the ToLine of the Send Mail task to be the value of a variable, using an Expression from the Properties window of the task.
We use a SQL table containing a list of email recipients for various conditions (table columns of kemail, emailaddress, success, error) and set flags in the table to 0=no, 1=yes for that particular user to receive emails on particular conditions.
Then create a variable that contains a delimited list of your recipients then use an expression to set "ToLine" for the send mail task.
The only thing to watch here is that you don't end up with a no records returned from the SQL table. We always have our "support" email address always having all the bits set, to avoid this.
So the package wont need to be modified when a new user needs to receive email updates.