CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • email can not be sent
Pages: [1]

Author Topic: email can not be sent  (Read 2554 times)

asiams

  • Guest
email can not be sent
March 02, 2010, 11:33:52 pm
When I send an email to contact I get a blank page:

Here is the error_log:

[Wed Mar  3 16:29:59 2010] [error] PHP Fatal error:  Cannot redeclare class Mail_mime in /home/qfyeqo/php/packages/Mail/mime.php on line 95

Can someone direct me where to look?

Thanks.


Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: email can not be sent
March 03, 2010, 08:13:48 am
Most probably CiviCRM tries to load the Mail_mime class from packages/Mail/mime.php while it’s already loaded by PHP from your platform’s PEAR sources; does this make sense?
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

asiams

  • Guest
Re: email can not be sent
March 03, 2010, 02:38:32 pm
Hello Piotr Szotkowski,

What is the solution for this?

Should I uncomment some code or use mail:mime instead?

What would you suggest?

thanks.

Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: email can not be sent
March 04, 2010, 04:36:01 am
You can try skip Mail_mime loading if it’s already loaded by patching packages/Mail/mime.php – you’d need to add

Code: [Select]
if (!class_exists('Mail_mime')) {

right below the opening <?php and a closing

Code: [Select]
}

at the end of the file.
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

asiams

  • Guest
Re: email can not be sent
March 04, 2010, 10:40:41 pm
Hello Piotr,

Thank you for detailed information. However, when I tried that, I still have problem sending email from the "send email" feature.

From SMTP setup, I was able to send email without any problem.

Any clue of this?

Thanks.


asiams

  • Guest
Re: email can not be sent
March 05, 2010, 12:58:45 am
Here is the code I modified:

mime.php

---------------

<?php

if (!class_exists('Mail_mime')) {

require_once 'PEAR.php';

require_once 'Mail/mimePart.php';

class Mail_mime
{

    var $_txtbody;

    var $_htmlbody;

    var $_mime;

    var $_multipart;

    var $_html_images = array();

    var $_parts = array();

    var $_build_params = array();

    var $_headers = array();

    var $_eol;


    function Mail_mime($crlf = "\r\n")
    {
        $this->_setEOL($crlf);
        $this->_build_params = array(
                                     'head_encoding' => 'quoted-printable',
                                     'text_encoding' => '7bit',
                                     'html_encoding' => 'quoted-printable',
                                     '7bit_wrap'     => 998,
                                     'html_charset'  => 'ISO-8859-1',
                                     'text_charset'  => 'ISO-8859-1',
                                     'head_charset'  => 'ISO-8859-1'
                                    );
    }

  ............................................. omitted .........................................................

 
    function _setEOL($eol)
    {
        $this->_eol = $eol;
        if (!defined('MAIL_MIME_CRLF')) {
            define('MAIL_MIME_CRLF', $this->_eol, true);
        }
    }

    

} // End of class

} // End of If Clause.


---------------

I hope this was right. Ones I added are in red/bold.

Can you verify?

Thanks.


Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: email can not be sent
March 05, 2010, 09:20:35 am
Yes, you patched it properly.

Quote from: asiams on March 04, 2010, 10:40:41 pm
However, when I tried that, I still have problem sending email from the "send email" feature.

What is the problem? (Note that the ‘Send Email to Contact’ might use packages/Net/SMTP.php instead, so if you get a similar warning, you might need a similar fix there.)
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

asiams

  • Guest
Re: email can not be sent
March 05, 2010, 09:45:35 pm
Thank you.

The patch worked really well.

Blessings!!


asiams

  • Guest
Re: email can not be sent
March 08, 2010, 03:04:09 pm
What is your apache error_log say?

It will show what is wrong with the blank page.

Then as the patch suggests, you should modify that file with blank page.

Hope you find the cause soon.


Piotr Szotkowski

  • Moderator
  • I live on this forum
  • *****
  • Posts: 1497
  • Karma: 57
Re: email can not be sent
March 09, 2010, 03:36:47 am
(That was a spam post, I deleted the account.)
If you found the above helpful, please consider helping us in return – you can even steer CiviCRM’s future and help us extend CiviCRM in ways useful to you.

alfred_nutile

  • Ask me questions
  • ****
  • Posts: 464
  • Karma: 14
    • River Valley Tech Collective
Re: email can not be sent
March 12, 2010, 05:14:24 pm
just wondering why all of this was an issue when Civi has the out going mail option?
sendmail
smtp or php
Does the email issue above not use those settings?

asiams

  • Guest
Re: email can not be sent
March 12, 2010, 10:17:19 pm
Hello alfred_nutile

I don't think that was the feature issue, but coding issue.

Depending on the server set up, this can happen. Mine happened because class was already issued, but trying to issue again. This caused the error. So the patch was checking to see if it is already issued, if not it will issue the class. If not, it will ignore. So the patch was working great.


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Installing CiviCRM »
  • Drupal Installations (Moderator: Piotr Szotkowski) »
  • email can not be sent

This forum was archived on 2017-11-26.