Jump to content

[Solved] Email and CPU Limits

Recommended Posts

Server = Tommy
Root Domain = computernerdkev.heliohost.org

Reading posts on the forum, I've noticed the 50 Email per day limit. I wasn't aware of this when I designed my online store (by which I mean wrote all the code from scratch in PHP) in 2017, but so far it hasn't been successful enough to be a problem anyway. :(

Nevertheless I've got a couple of expansions in the works and they could lead to more Email traffic. One part will involve users submitting digital content to be sold, similar(ish) to Ebay, and I may decide to implement a user setting where instead of "sellers" getting an Email for each sale, they get a weekly summary. This would mean sending an Email to all "sellers" once a week, so that would lower the headroom for other Emails on that day.

For the moment though, for each order an Email is sent to me, and to the buyer. Also, for a bit of redundancy in case of outages, I have the Emails for me sent to an Email account on the HelioHost server, which forwards them to an account registered with another Email provider.

So, Question 1 is:
Does this (previous paragraph) equal 2 Emails, or 3 Emails (or 1 Email, if neither Emails to accounts on the HelioHost server, nor automatic forwarding to external accounts, are included in the count (if so, that's proably a bit of a loop-hole)).

Also, searching through the forums I've found that HelioHost is happy with extending the limit if users can convince them that they're not a spammer. It seems that I still need to work out a new limit to request though, which is a little tricky. If I were to say that I'd never expect more than 100 orders a day, that would probably make 100x[answer to question 1] per day, plus another 75 for Emails to "sellers" in that part of the store. Then plus the number of sellers I can expect to turn on the weekly summary function if I decide to include it, which is really quite hard to guess... perhaps I'll say 200, but I want to say more.

Given that I find setting a limit within the range of past requests so difficult. I'm tempted to simply configure the PHP mail() function, which I've used, naturally enough, for all the automated Emails, to use an external Email server. This turns out to be easier said than done on Linux. I wanted to use msmtp if it were available and configure PHP to use it in place of sendmail (with command line options setting it to use my desired SMTP server), but it turns out the PHP configuration option to set the command used by the mail() function can't be changed in .user.ini, only in php.ini.

I know there are other ways to send Email from PHP besides mail(), but I don't want to change the code, and mail() looks to be the simplest and easiest method to program.

Question 2 is:
Is there any recommended way to set an external server for sending Email from PHP using mail() within the limits of a Heliohost account?

Finally, on another topic. Part of the digital marketplace type site that I described earlier will be to have images uploaded by users to match their products (up to around six). Ideally I'd use the PHP "GD" functions to resize these images to three sizes (and probably delete the original to save space).

Question 3 is:
Assuming that I allow for large image sizes to be uploaded, would resizing six high-res JPEG images to three different sizes (18 conversions) in one script be enough to risk triggering excessive CPU usage and cause my account to be suspended. Keep in mind that this would be a somewhat infrequent event. Initially some manual verification may be required for each new listing, so if I have to do the image conversions on my own computer as well, that wouldn't be a huge issue.

Thank you, and sorry for the long post.

PS. I really think that the Email limit should be mentioned somewhere on the Wiki along with the other limits.

Answers to Krydos' standard four questions for the over-zealous Emailer:
    How do you get the email addresses for your mails?
Either I programmed them into the PHP scripts (the emails sent to me), or users submitted them when placing an order. Coming soon: Sellers submit them during account creation.

    How do people unsubscribe from the emails?
I give up all this nonsense and close down the whole website. Users choose not to place any more orders (the only thing that causes an Email to be sent to them is when an order is paid for (or fails to be paid for) and when an item is posted)). Coming soon: Sellers close their account on my website.

    How many emails do you expect to send a day to begin with?
Answer question 1, then see following paragraph.

    Please provide an example email.
Grumble, grumble. OK here are some redacted examples from when I was first testing the site:
Buyer successfully paid for an order
Buyer unsuccessfully paid for an order (payment details didn't match the order correctly)
Buyer's order has been posted

The Email format for the marketplace bit of the site hasn't been done yet. This includes emails to sellers, and order confirmation emails for digital-only orders which may include temporary links for downloads.

The Emails to me are basically the same but less polite and with technical detail about the payment errors.


Link to comment
Share on other sites

To keep it short:


3 emails. Forwarded mail and mail sent to yourself still counts.


External server is not supported for mail(), you need to use smtp functions or sockets to do this.


For load, it may or may not be. Depends how busy the server is. Our load detection is kind of odd. There's no set amount that any one account can cause, but rather it become easier to get suspended as server load rises. Easiest way to control this is to not let them upload all 6 pictures at once. I've been using GD for small pictures for years without issue. Just do it one at a time, preferably with a gap in between.

Link to comment
Share on other sites

For sending mail you could use some service like SendGrid using their APIs. They are really useful and they handle all DKIM and domain verification stuff too so the mail goes straight to the Inbox instead of landing up in spam.


You will get 15,000 mails/month for free if you are a student!

Link to comment
Share on other sites

Thanks, I'll consider using 3rd party Email libraries later but for now that adds up to (100*3)+75+200 = 575 as my desired Email limit, going on what I wrote before. Can I request here for my limit to be raised to 600?


I might do the image conversions manually for starters. If the threshold is flexible that makes it a bit hard to be confident, it could work all the time during testing then one day someone uploads a large image while there happens to be high load and suddenly I'm kicked out. Though limiting the upload size to 1 or 2MB might prevent the worst cases.

Link to comment
Share on other sites

The limit is now 600 for your account. If you exceed the limit with php mail() function it's not the end of the world anyways. You just get throttled to only being able to send 1 email per hour, and the rest get queued up. You'll start getting a lot of bounce-back type emails saying your send limit has been exceeded if this happens.

Link to comment
Share on other sites

Just use sendmail() instead of mail(), and specify an external SMTP server. There are many free e-mail hosting services that allow unlimited outgoing mail.

Link to comment
Share on other sites

@Krydos: Thank you.


@icn: There's no "sendmail" on the functions list in the PHP manual, so that must be using one of the 3rd party libraries. I've noted a few, such as the Mail package in PEAR and PHPMailer. I try to avoid using libraries/packages to make to site easier to test and maintain, but I'll probably end up using one for this at some point.

Link to comment
Share on other sites

This topic is now closed to further replies.
  • Create New...