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 »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Email problems in CiviContribute
Pages: [1] 2

Author Topic: Email problems in CiviContribute  (Read 7565 times)

alansch

  • Guest
Email problems in CiviContribute
June 04, 2009, 04:14:15 am
We are encountering email problems when a contribution is entered. The problem is different depending on whether the contribution is by an individual or is made on behalf of a company/business/organisation.

Quote
Global Settings/Outbound Email configured for SMTP on localhost initially, later reconfigured to use sendmail at the path reported by CPanel.

Civicontribute Settings:
Thank-you and Receipting is configured for
Email Receipt to Contributor?  YES
Receipt From Email:  office@<domain-name>
CC Receipt to:  not set
BCC Receipt to:  admin@<domain-name>
Both office@ and admin@ confirmed as set up on the server (as email account forwarders to the intended recipients' ISP email accounts)

If a contribution is made by *an individual*... the individual receives *two* copies of the "receipt" email at the email address they entered ... and the configured bcc is not notified.

It seems as if the emailing part of CiviContribute is getting confused and sending the bcc to the contributor instead of the address configured in "Thank-you and Receipting".

However when a contribution is made as an organisation, an error message is received (see below). Email-wise the only difference between the two forms (individual vs organisation) is that the organisation contribution form requests two emails - firstly for the organisation and secondly for the individual contributing on behalf of the organisation. Note that neither the contributor nor the BCC Receipt addressee receive emails in this situation.

I then configured Outbound Email to use sendmail (with the correct sendmail path as reported by cpanel). The same behaviour was observed - two emails received by the contributor, no email received by the specified BCC recipient, and when the contributor identified himself as an organisation, another, slightly different error message was received (see second quoted error below).

This would seem to indicate that CiviContribute is getting horribly confused as to which email addresses it is supposed to be sending to. To the point that when faced with two emails (both the same) for the contributor and organisation, it fails to send *any* emails.

  • Has anyone else run into this problem?
  • Can anyone suggest a fix or workaround?
  • Alternatively, can someone tell me which source files actually handle the CiviContribute email generation so I can try to fix the problem myself? (I did have a brief look but failed to find the email generation code.)
  • Or is it simply that I have done something totally stupid in my configuration. (In which case, please tell me what I've done wrong so I can fix it.)

Error message received when attempting to contribute as an organisation (SMTP)...
Quote
    An error occurred when CiviCRM attempted to send an email (via SMTP). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.

    The mail library returned the following error message:
    Failed to add recipient: @localhost [SMTP: recipient is not recognized (code: 501, response: <@localhost>: no local part)]

    This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » Global Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:

        * Your SMTP Username or Password are incorrect.
        * Your SMTP Server (machine) name is incorrect.
        * You need to use a Port other than the default port 25 in your environment.
        * Your SMTP server is just not responding right now (it is down for some reason).
        * The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.
Error message received when attempting to contribute as an organisation (Sendmail)...
Quote
    An error occurred when CiviCRM attempted to send an email (via SMTP). If you received this error after submitting on online contribution or event registration - the transaction was completed, but we were unable to send the email receipt.

    The mail library returned the following error message:
    sendmail returned error code 1

    This is probably related to a problem in your Outbound Email Settings (Administer CiviCRM » Global Settings » Outbound Email), OR the FROM email address specifically configured for your contribution page or event. Possible causes are:

        * Your Sendmail path is incorrect.
        * Your Sendmail argument is incorrect.
        * The FROM Email Address configured for this feature may not be a valid sender based on your email service provider rules.

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Email problems in CiviContribute
June 04, 2009, 06:16:08 am

The mail code for contributions is:

CRM/Contribute/BAO/ContributionPage.php, function sendMail

you might want to add some debug statements there and find out whats happening

You might also want to add:

define( 'CIVICRM_MAIL_LOG' , 1 );

with that setting, all mail is stored in md5 named files in files/civicrm/upload/mail/

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Email problems in CiviContribute
July 09, 2009, 10:41:52 am
We just encountered the same issue when folks sign up "on behalf of" (required). They receive the error message below, and the messages aren't sent to the bcc. Was a solution found?
--
Joe

alansch

  • Guest
Re: Email problems in CiviContribute
July 09, 2009, 02:55:27 pm
I'm afraid I have not had the time to trace out the problem as yet.

The problem is *not* in the mailer. The mailer is being sent a null email address from somewhere upstream, hence the error being generated.

I had to shelve the issue for the time being after having inadvertently generated several *hundred* megabytes of trace and shutting down the site until they were deleted --blush--

It's still in my pending queue but I can't predict at this time when I will be able to get back to it.

Hopefully someone else will have the time to look into it sooner.

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Email problems in CiviContribute
July 11, 2009, 09:29:31 pm
I tried this on the demo site "Member Signup and Renewal" (with "on behalf of" as required) first with Outbound Email set to SMTP settings and no error message was encountered. I then changed the Outbound Email to Sendmail and the error appeared after going through the contribution form.

I then changed the "Member Signup and Renewal" to have "on behalf of" as optional and tried 'joining' as an individual (Outbound Email set to Sendmail) and the same error appeared. It doesn't appear to be "on behalf of" related, but a problem with the settings for the Sendmail function.

Seems like a bug, should an issue be filed?
« Last Edit: July 11, 2009, 09:49:54 pm by joemaine »
--
Joe

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Email problems in CiviContribute
July 12, 2009, 07:38:06 am

on the demo server, the error message was right :)

the sendmail path was wrong. the right sendmail path is: /usr/sbin/sendmail (on ubuntu)

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Email problems in CiviContribute
July 12, 2009, 03:38:06 pm
It would have been much easier if it was a bug ;-)

While running through more testing I found (and duplicated on the demo site) a bit of odd behavior.

If an organization has the Primary Location set to "Main" and also checked as the "Billing Location" the "Billing Location" will get unselected after a contribution "on behalf of".

...still searching for a solution for the sendmail error...
--
Joe

alansch

  • Guest
Re: Email problems in CiviContribute
July 12, 2009, 04:41:03 pm
There is definitely a bug in there somewhere. And it seems to be well before the actual email step.

Although my accidental massive trace files were largely useless, I did ascertain that the reported error condition arises for both sendmail and SMTP when a NULL email address is sent through from somewhere upstream of the mailer routine for "on behalf of" contributions. The contributor's email address is somehow getting lost, or getting wiped out by something.

As reported earlier, the other bug-like behaviour I noticed, that does seem to be related, was for individual contributions... if a BCC email address had been defined, the BCC address would be overridden by the email address entered by the contributor. This leads to the contributor receiving two receipt emails and the defined BCC recipient receiving nothing. (And thus, if the contributor's email address had been lost or wiped somewhere prior to this step, the BCC recipient will be NULL also.)

At the time no CC address had been defined - I believe but can not confirm that the same behaviour occurred with both BCC and CC defined, and with only CC defined. It is obviously a non-issue if neither CC or BCC addresses are defined.

I hope this helps characterise the problem - I'm still drowning with other issues here and unable to get back to this one.

joemaine

  • I post occasionally
  • **
  • Posts: 114
  • Karma: 3
  • CiviCRM version: 4.1
  • CMS version: Drupal 7.14
  • MySQL version: 5.1
  • PHP version: 5.2
Re: Email problems in CiviContribute
July 12, 2009, 09:58:17 pm
I've been playing around with sites/all/modules/civicrm/CRM/Utils/Mail.php

Adding the Bcc line to the following helps preserve the Bcc

        $headers = array( );  
        $headers['From']                      = $from;
        $headers['To']                        = self::encodeAddressHeader($toDisplayName, $toEmail);  
        $headers['Cc']                        = $cc;
        $headers['Bcc']                       = $bcc;
        $headers['Subject']                   = self::encodeSubjectHeader($subject);

$toDisplayName will bring a value, but $toEmail is null.  I set the 'To'  = $cc so that all fields would be populated in an email, but the error is still visible and an email is sent to "Return Path" with the following:

Quote
"A message that you sent contained a recipient address that was incorrectly
constructed:

  @localhost  no local part

The message has not been delivered to any recipients."

It doesn't appear that a null 'To' field is causing the error - other thoughts?

Seems to be a reincarnation of:
http://www.nabble.com/Test-mailing-must-be-from-localhost--td6310858s15986.html

...or does it have anything to do with the localhost value in
sites/all/modules/civicrm/CRM/Core/Config.php

BTW...this seemed to work fine before the upgrade to 2.2.3+
« Last Edit: July 13, 2009, 06:16:40 am by joemaine »
--
Joe

samwise

  • Guest
Re: Email problems in CiviContribute
September 01, 2009, 07:26:02 am
We ran into this problem as well.  The cause was line 146 in CRM/Contribute/BAO/ContributePage.php

Code: [Select]
list( $displayName, $email ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $contactID, false, $billingLocationTypeId );
This explicitly sets the Organization's Billing email as the address to which the receipt should be sent.  "On Behalf Of" contribution pages use the entered Organization's address as the Main email address.  Consequently the $email variable gets an empty value which throws off the CRM_Utils_Mail::send() function a little lower down.

Solution: Adjust line 146 to remove the Billing location requirement:

Code: [Select]
list( $displayName, $email ) = CRM_Contact_BAO_Contact_Location::getEmailDetails( $contactID, false );

This is on CiviCRM 2.2.5

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Email problems in CiviContribute
September 14, 2009, 03:28:33 pm
Filed an issue related to this bug: http://issues.civicrm.org/jira/browse/CRM-5042

Kurund
Found this reply helpful? Support CiviCRM

jacoblee

  • Guest
Re: Email problems in CiviContribute
September 20, 2009, 10:18:40 am
The Same thing is happening is Civi 3.0 I am getting a null email field when I try and make a contribution. Only users who are previously registered on the Joomla site get the Thank you Receipt.

I saw you fixed it in 2.2.9 could you make the fix in 3 series as well.

Thanks,

Jacob Lee

wmburke

  • I’m new here
  • *
  • Posts: 8
  • Karma: 2
    • Open Forum Foundation
Re: Email problems in CiviContribute
February 11, 2010, 07:11:37 pm
Heya. I'm getting this problem now - although it appears you solved it previously.

I'm running 3.0.2 in Drupal.

What say?

Arjan

  • Guest
Re: Email problems in CiviContribute
February 15, 2010, 01:01:28 am
I'm also seeing these things happen in 3.1.1. I'm using sendmail, no error messages, but incorrect behavior:

* Like alansch noted above (http://forum.civicrm.org/index.php/topic,8284.msg38054.html#msg38054), when I define a BCC, this email gets overridden with the user-supplied email address so user receives two emails.
* With donating on behalf of an organization set to optional, using this option results in all name and address information I collected in a profile not being emailed in the receipt (the labels are there, but not the supplied values). This information is however present on the confirmation page.

The first problem seems to me like a bug (?), could the second be in the email template or somewhere in the settings, since the values fom the profile are recorded?

Edit: also with 3.1.2. And rather than being just empty, the name and address from the profile are not empty, but get overridden by the organization's details. So email, street etc. for the donating person are replaced by the organization's details, while first and lastname remain empty (because these are not filled in on the 'on behalf of' section?).
« Last Edit: February 15, 2010, 04:28:23 am by Arjan »

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: Email problems in CiviContribute
February 15, 2010, 09:32:54 am
hey Arjan,

functionality seems to be working fine for my local install for CiviCRM v3.1

can u try to replicate issue on our public demo : http://demo.civicrm.org/

If issue persists, please give exact steps to replicate that would be very helpful to debug.

thanks

kiran
You Are Designed To Choose... Defined By Choice.

Pages: [1] 2
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using CiviContribute (Moderator: Donald Lobo) »
  • Email problems in CiviContribute

This forum was archived on 2017-11-26.