开发者

Zend_Mail - Reading Email attachments - Bounce back emails that are too large

开发者 https://www.devze.com 2023-04-12 09:06 出处:网络
I am working on a application using zend and I am using zend_mail to read the emails. I am able to get all the emails and parts of the email. The only issue I am having is if a user send a large attac

I am working on a application using zend and I am using zend_mail to read the emails. I am able to get all the emails and parts of the email. The only issue I am having is if a user send a large attachment it breaks the script.

Example User Send

Message -> Mutiple Parts -> Atachment 1 = 10mb
                            Atachment 2 = 8mb
                            Atachment 3 = 9mb
                            Atachment 4 = 8mb
                            Atachment 5 = 9mb 

I get

<font color=ff0000>
Fatal error: Allowed memory size of 67108864 bytes exhausted (tried to allocate 33878183 bytes) in /home/bizva开发者_如何学Gor/public_html/login2/library/Zend/Mime/Decode.php on line 120
Segmentation fault

I know the problem is because the email is to large. I can fix this by adding more memory to my script example.

ini_set('memory_limit', '256M');

Then it works.

The problem if they send a larger file then I will have the same issue.

How can I prevent large files from coming in and maybe bounce them back.


I think you'll need to set a "reasonable" size limit and check the attachment file sizes before calling the createAttachment() method, not allowing to attach too many big files.

Hope that helps,

0

精彩评论

暂无评论...
验证码 换一张
取 消