Reputation: 3581
I have a problem with my PHPMailer class. There is a form with file upload functionality. The file uploads fine with no errors. But I get the following output from the script:
Could not instantiate mail function. Unable to send message to * @ *.com
This happens only with the attachments of more than several megabytes. My php.ini configuration is fine:
post_max_size = 50M
upload_max_filesize = 50M
When I get this value below the actual upload size, then the page just refreshes and nothing happens. With the following values the file is uploaded and stored in the temporary folder but cannot be sent as attachment.
Any help will be appreciated
PS I can send emails with attachments of 1 MB with no problems
Upvotes: 0
Views: 1819
Reputation: 272006
I had similar issue where exim was rejecting emails larger than ~700KB.
You cannot always edit mail configuration files on shared servers. The solution I used was to use my ISP's SMTP server to send emails.
1) Create an email address or use an existing one and note down all settings including:
2) Instead of messing with class-phpmailer.php
use a wordpress plugin called "WP Mail SMTP" which:
Reconfigures the
wp_mail()
function to use SMTP instead ofmail()
and creates an options page to manage the settings.
After installing the plugin, enter the information from step 1 in the plugin settings page.
Upvotes: 0
Reputation: 3581
Okay, answering my own question. Sorry for wasting anyones time. First of all, a look on /var/log/mail.log revealed this line
Oct 4 20:15:39 s16271040 postfix/sendmail[13663]: fatal: @.com(33): message file too big
That made more sense now.
We go to /etc/postfix/main.cf and add the following line to the end of the file
message_size_limit = 20480000
And we have 20MB limit for file attachments, hooray :)
Upvotes: 4