Out of Memory Error when sending email.
  • rkolechrkolech October 2009

    Hello,

    I am new to this application and I am trying to get it set up for the first time. I have everything working accept the e-mail functionality. Whenever I try to email and invoice I get the following error:

    Fatal error: Out of memory (allocated 32243712) (tried to allocate 837194 bytes) in ....../simpleinvoices/library/mail/class.phpmailer.php on line 1126

    This is the actual line:
    /* chunk_split is found in PHP >= 3.0.6 */
    $encoded = chunk_split(base64_encode($str), 76, $this->LE);

    I have created a PHP.ini file to overwrite the default values of my Host. I have no problems creating PDF files. I have put a copy of the PHP.ini file in both the root simpleinvoices/ folder as well as the /simpleinvoices/library/mail/ where the php file in question is located.

    Could this error be caused by invalid smtp settings in the config file? Since I have never been able to send an email I can't verify that these settings are correct.
    Does anyone have any ideas? Thanks.

  • justinjustin October 2009

    hey rkolech

    if your host doesn't allow email out - i know my old host didn't allow this - than this may be causing the - but i not 100% sure on that

    have you entered a username/password etc.. for smtp in the config.ini file?

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • rkolechrkolech October 2009

    Thanks for your reply Justin
    I am trying to use the gmail smtp server. Here are the settins that I am using, got the details from the gmail website:

    email.host = smtp.gmail.com
    email.smtp_auth = true
    email.username = [email protected]
    email.password = gmail_password
    email.smtpport = 587
    email.secure = ssl
    email.ack = false


    Has anyone used gmail successfully with this application? As for my host, they do allow email, and they also have an smtp server. As of right now I don't have any mailboxes set up with them though, they are just forwards to my gmail.

  • justinjustin October 2009

    hey rkolech

    gmail is a pain to use with phpmail (the php class we are using for email) once we swap to zend_mail will be ok

    so basically i don't think you'll get Simple Invoices working with gmail smtp
    - ask your host - maybe you can use their smtp server

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • rkolechrkolech November 2009

    Hello Justin,

    I have tried to use my hosts mail server and still no luck, the issue seems to be with the mail class running out of memory, I put bad data into the config file to see what error I would get, and it was totally different. So I am guessing that the settings are correct.

    I then got a newer version of phpmailer but still getting the exact same error, but now its on a different line number as the code has changed and that line has moved. I am all out of ideas at this point. I notices a Zend folder in the library folder. Can I configure the application to use Zend instead of phpmailer?

    Thanks.

  • starscreamstarscream November 2009

    I have a partial fix, which will lead you to a bigger problem:
    Download this patch: http://sourceforge.net/tracker/download.php?group_id=26031&atid=385710&file_id=226836&aid=1708567

    Now SSL should work fine, but Gmail also uses STARTTLS. PHPMailer will give you this error: Mailer Error: Language string failed to load: from_failed. STARTTLS requires that the connection must be made before trying to send an e-mail (phpmailer::SmtpConnect()) and that's going wrong. I haven't found a solution for that yet.

  • justinjustin November 2009

    @rkolech
    re zend
    - you can try - you have to redo all the Simple Invoices email code - refer post below
    -- if your interested in doing this - would be a great help to Simple Invoices

    @starscream

    - might be quicker to swap phpmailer for zend_email
    -- just need to redo the email code in http://code.google.com/p/simpleinvoices/source/browse/trunk/modules/invoices/email.php

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • starscreamstarscream November 2009

    You're right Justin, moving to Zend Email would fix it. Will take a look at it next week, if rkolech doesn't answer anymore.

  • starscreamstarscream November 2009

    I've finished the implementation. Anyone who wants to test it before I commit it? Gmail seems to work for me now. I only couldn't implement ACK, what's it used for? Also there seems to be a problem when I catch exceptions, so the error handling is a bit nasty.

    Regards Starscream

  • starscreamstarscream November 2009

    Oke, I just committed it for everyone. The exception handling is fine now, BTW.

  • justinjustin November 2009

    thanks !!!

    note: http://code.google.com/p/simpleinvoices/source/browse/trunk/modules/invoices/email.php?spec=svn2672&r=2672#13
    - shouldn't need that error_reporting as is defined in config.ini

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • justinjustin November 2009

    re ACk
    - this was for read recipts of emails
    - not sure if zend_mail can do read receipts

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • starscreamstarscream November 2009

    Committed the new version. Couldn't find ACK support in the documentation nor in the code..

    PS: For Gmail set the 'email.secure' configuration to 'tls' instead of 'ssl'.

  • justinjustin November 2009

    thanks

    you can remove the email.ack property from config.ini if you want

    cheers

    justin

    SmarterInvoices.com :: Simple Invoices hosting | Kelly.org.au :: Simple Invoices custom development | justin.kelly.org.au
  • ameedameed February 2011

    @justin wht is the e-mail.ack property do exactly?

    Best Regards,

    Ameed Jamous

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Apply for Membership

Categories