0

I'm implementing a program of sending email using Codeigniter Email class and gmail smtp. I find it works when the attachment is small (e.g., less than 1MB) but if it's large (e.g., 5MB) then the attachment cannot be sent with the email, though the email itself can be sent without any errors. I checked my host (I'm using Ipage hosting service by the way), the attachment is successfully uploaded to the host, so it's not a problem of uploading. I also checked the php.ini on Ipage host, here are relevant parameters, they all seem to be OK:

memory_limit = 256M
max_execution_time = 120
upload_max_filesize = 8M
post_max_size = 20M

I tried using localhost it didn't work with large attachments either.

Could anybody tell me what the problem could be? Thank you very much! I did a search on Stackoverflow and I'm sure I didn't see any same issues.

Tao Hu
  • 57
  • 1
  • 9
  • maybe the client doesnt accept it - many servers out there refuse to accept large emails - GMail for instance allows max. 25MB as you can read here https://support.google.com/mail/answer/6584 - so its probably a client problem... – Atural Feb 24 '18 at 11:53
  • Not in my case, because I'm actually sending email from a Gmail account to another Gmail account. As you said, the max is 25M. – Tao Hu Feb 25 '18 at 21:42
  • Well your upload Max filesize is 8m, you sure it's not over 8 that you are trying to send? – Alex Feb 25 '18 at 22:09
  • you should definitely try to send that with phpmailer - because the debug options with phpmailer are much more informative - take a look here and use the debug options as described in the docu https://stackoverflow.com/questions/44843305/how-to-integrate-phpmailer-with-codeigniter-3 – Atural Feb 25 '18 at 22:44

1 Answers1

0

I eventually found out the reason. It's actually not a problem of file size or rather a problem of file name. If the attachment name contains spaces, it won't be sent with the email text and no errors reported. To solve this problem, I use the Codeigniter Inflector Helper (the underscore function).

Tao Hu
  • 57
  • 1
  • 9