Hi,
To send mail, a PHP script must build the entire email in memory.
Also, attached files can use up to double the memory of the actual file size (due to encoding).
So, attaching a 40MB file might well use 80MB-100MB or more of memory.
(In theory, a script could build the email in a file and then execute an external operating system command to send the email from the file. Unfortunately, that's not operating system independent and is not always permitted even when possible.)
If you need to email large files, then you just need to be able to allocate the memory.
In the 21st century (with fast 32 bit and 64 bit processors), it's really not unreasonable for any program (including PHP scripts) to temporarily use several hundred megabytes of memory.
Of course, shared hosting must have limitations to be fair to everyone sharing the resources, and this is one limitation that your host is enforcing.
Your options are:
- Convince your host to allow larger PHP memory allocation.
- Upgrade to a VPS (where you have control of the configuration of your server software).
- If you can use an external OS command to send email (e.g. "sendmail"), then write additional PHP code to build the email in a file and call that command. You can utilize FormMail's Hook System to incorporate the additional code and still keep all the other functionality of FormMail.
Bookmarks