I am using sheetson free plan which mentioned unlimited row per sheet. But when I fetch the api from google sheet, I only received 24 rows. I can't figure out why didn't retrieve full list of data which is 32. Is that limit from the google sheet api itself or the wrong information on sheetson website. Please help. enter image description here
enter image description here
as you said you have to pass params = {"limit": "100"} when you call requests.get. There's a limit of 100 rows that you can retrieve at once, to overcome it use {"skip": "100"} and it will skip the first 100 rows. Answering in case someone has the same doubt we both had at some point
I want to set a max number of email sent a day for each mailbox on hmailserver to avoid spamming.
I am looking for an issue to do this in hmailserver administration and COM API.
I believe there's no such property in hMailServer. You must define a script on OnAcceptMessage event to implement this behaviour hMailserve doc | OnAcceptMessage.
For the number of emails sent per day you must create some kind of counter (a database table with username, date and count fields) and get the current number of messages in the body of the OnAcceptMessage function. If the count per current user and current day will be reached then reject the email with return code 1 or 2 and a meaningful message. If the count is less return 0 and the email will be sent.
I am using the api sending messages in batches.
I'm getting many messages with code 400 and 500.
I need to control the time between requests when sending multiple batches?
example:
messages.get = 5 per second
If I send 100 messages in a batch request, have to wait 20 seconds to send the next batch?
or
need to send 20 requests with 5 messages each?
At this point probably batches of 10 messages each is best. You can change the per-user limit to 50/sec using the developers console. Even then, you can exceed the limit for a little bit before you start getting quota errors. Either way, if you get quota errors for a user you'll want to do some type of backoff for the user.
Suppose we want to develop a website. Key features:
home page (access for all) the main element on the page is the
sum of payments
registration and login page - mail address and password, account activation
the payment will be declared by the registered and logged in users through the form and a checkbox, when the checkbox is selected data should be uploaded to the server and saved if "pass verification" for example, do not exceed $ 10, each user in one day can only declare one payment
after possitive verification the sum from "number 1 above" is updated
additional features - user notification: when the last payment hasn't been made for more than six months, or if the total sum exceeds a certain level eg $ 1,000...
Is it possible that the whole solution would be based on angularfire? In particular:
the sum of payments - on main site the information about
the sum avaible for all visitors, so each time somebody visits the website
we will have to send request to Firebase to get all the records and
add the payments to finally show the sum on web site? With Angular we can do that?
Firebase enables queries/limits: e.g. last 20, but to get the whole amount you need to have knowledge of the previous value - in this case, increase in payments and visits will result in sending large amounts of data client side vs firebase - whether and how it can be optimized?
suppose that the activation of user account will require small payment
(paypal/transfer) is it possible to set account active when the
payment is done?
I'm trying to solve the bouncing email issue based on "Mail box full" by creating a trigger that resends the message if the message contains "mail box full".
The issue I'm facing is that I need to limit the number of resend to 3 times.
What I have now keeps resending the email as soon as a bounced email is received.
My trigger is
trigger trgBouncedEmails on EmailMessage (after insert) {
for(EmailMessage myEmail: trigger.New) {
//mail box full bounced email
if (myEmail.HtmlBody.contains('full'))
{
Case[] parentCase = [Select c.Id from Case c where c.Id =: myEmail.ParentId];
if (myEmail.Subject.contains('Financial Review'))
parentCase[0].Resend_Email_Send__c = true; // this will trigger a workflow to send the email again.
Update parentCase;
}
}
}
How can I limit the resending, is there a way I can set a wait time before I do the "Update parentCase"
Is there a better way to solve this issue, knowing that I have different types of emails, each one has a different template and a different purpose.
EDIT
The system should automatically re-send the email 3 times in the frequency of 24hours, and then stops resending after 24hrs. My trigger keeps resending indefinitely and I'm trying to find a way to put a wait so it can only send 3 times in 24hrs period, like once every 8hrs.
#grigriforce beat me to the punch - I would also suggest using a field to count the number of retries, rather than a simple boolean value. Here's a "bulkified" trigger with essentially the same logic as the one you posted:
trigger trgBouncedEmails on EmailMessage (after insert) {
List<Id> parentCaseIds = new List<Id>();
for ( EmailMessage myEmail : trigger.New ) {
// mail box full bounced email for Financial Review emails
if ( myEmail.HtmlBody.contains('full') && myEmail.Subject.contains('Financial Review') )
parentCaseIds.add(myEmail.ParentId);
}
Case[] parentCases = [select c.Id from Case c where c.Id in :parentCaseIds];
for ( Case c : parentCases ) {
c.Resend_Email_Count__c += 1; // this will trigger workflow to send the email again
c.Resend_Email_Time__c = System.now(); // keep track of when it was last retried
}
update parentCases;
}
Update to space emails out evenly over a 24-hour period:
Rework your workflow to make sure it has been 8 hours since Resend_Email_Time__c was last set, and then schedule an Apex job to run every hour to pick up eligible Cases that need to have their emails resent, and call update on them to make sure the workflow doesn't go too long without firing:
global class ResendCaseEmails implements Schedulable {
global void execute(SchedulableContext sc) {
Contact[] cs = [select id, Resend_Email_Count__c, Resend_Email_Time__c from Contact where Resend_Email_Count__c < 4];
List<Contact> ups = new List<Contact>();
for ( Contact c : cs ) {
if ( c.Resend_Email_Time__c != null && c.Resend_Email_Time__c.addHours(8) < System.now() )
ups.add(c);
}
update ups;
}
}
**note that it's not a best practice to have this code in the class that implements Schedulable - this code would ideally be in another class that is called by the ResendCaseEmails class.
You can schedule this job to run once an hour by calling this code from the developer console:
ResendCaseEmails sched = new ResendCaseEmails();
String cron = '0 0 * * * ?';
System.schedule('Resend Case Email Job', cron, sched);
You could simply change the resend boolean on the case to an integer count of the send attempts and have your workflow rule re-send only while that count is less than 3.
Case[] parentCase = [Select c.Id, c.Resend_Email_Count__c from Case c where c.Id =: myEmail.ParentId];
if (myEmail.Subject.contains('Financial Review'))
parentCase[0].Resend_Email_Count__c += 1; // this will trigger a workflow to send the email again.
Update parentCase;
Also, I assume that you simplified the trigger to show the problem but if not you really need to bulkify it.
So, here's what you'd like to happen (feel free to correct me if I am wrong). You send an email, and if it bounces you'd like to re-send an email every 8 hours. The number of resends should be 3 max.
I would not use only triggers for this scenario. I'd instead design a solution using a Trigger, Scheduler, and maybe a custom table to keep track of the bounced email(s).
Let's call this table/object "Bounce Email Tracker". It'll have the following 3 fields:
Email Name (some unique description of email)
Email status (Sent, Bounced, ReSent, Failed)
Resend Count
Sent email Timestamp
If and when an email is sent you'd create an entry in this table using a trigger with the status set to "Sent" and the "Sent email . If the email bounces, another trigger would "update" the entry in the table to change the status of the record to "Bounced".
A scheduler will run regularly which will retrieve all records from this new table where status equals "Bounced", and check the last time the email was sent using the value in the "Sent Email Timestamp". It will do the following actions depending on the time sent, and resend count.
If the resend count is less than 3, and if the last email was sent more than or equal to 8 hours ago, send another email from the scheduler. Change the status of the record to "Sent".
If the resend count is more than 3, and the status is "Bounced", change the status to "Failed".
If the resend count it less than 3 but the last email was sent less than 8 hours ago, don't do anything.
I know this is a lot of effort, and I am sure it probably needs more thought, but this will provide a robust framework to track and resend bounced emails.
Hope this helps!
Anup