Body: <p>I just created a contribution (Payment) page in CiviCRM 4.7.27, and I was testing it. I put in an e-mail address in the "from" field, but I left the "from name" blank (it was not shown as required on the form).</p>
  
  <p>When I confirmed the payment, I got the following warning message:</p>
  
  <blockquote>
    <p>Notice: Undefined index: receipt_from_name in CRM_Contribute_BAO_Contribution::generateFromEmailAndName() (line 4741 of /home/secondci/public_html/drupal/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php).</p>
  </blockquote>
  
  <p>An e-mail was sent, but the "from" address was the default for our site: "webmaster@..." not what I had put in the payment form: "registrar@..."</p>
  
  <p>This seems to be similar to errors reported by other users.  That line of code in Contribution.php looks like this:</p>
  
  <pre><code>  return array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']);
  </code></pre>
  
  <p>I changed it to this:</p>
  
  <pre><code>  return (array_key_exists() ? array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']) : array(' ', $pageValues['receipt_from_email']));
  </code></pre>
  
  <p>Is this the right thing to do? I have just registered for the CiviCRM site, if that is the correct place to post something like this. Any other suggestions?</p>
  
  <p>Oh, and there is a typo on line 4730:</p>
  
  <pre><code>// Use input valuse if supplied.
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-29T16:21:08.473Z
Comments.Text: Welcome Michael, can you tell us what version of the CiviCRM you are using? Thanks for reporting the typo in the comment. It's not advisable to edit the CiviCRM code directly but did your edit solve the issue? Consider browsing the Issue Tracker or filing a report: https://issues.civicrm.org/jira/projects/CRM/issues/CRM-20800?filter=allopenissues
Comments.UserDisplayName: Christia
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-11-29T20:17:08.330Z
Comments.Text: I am using 4.7.27, and the change in code did make the warning go away. I've just registered for civicrm.org, and I'll attempt to file a report there.
Comments.UserDisplayName: Michael Collins
Tags: <drupal><civicontribute>
Title: Getting "Undefined index" error when sending an email after testing a contribution page
ThreadText: # Getting "Undefined index" error when sending an email after testing a contribution page
  
  (Asked by: username_0 on 2017-11-28)
  
  I just created a contribution (Payment) page in CiviCRM 4.7.27, and I was testing it. I put in an e-mail address in the "from" field, but I left the "from name" blank (it was not shown as required on the form).
  
  When I confirmed the payment, I got the following warning message:
  
  > Notice: Undefined index: receipt\_from\_name in CRM\_Contribute\_BAO\_Contribution::generateFromEmailAndName() (line 4741 of /home/secondci/public\_html/drupal/sites/all/modules/civicrm/CRM/Contribute/BAO/Contribution.php).
  
  An e-mail was sent, but the "from" address was the default for our site: "webmaster@..." not what I had put in the payment form: "registrar@..."
  
  This seems to be similar to errors reported by other users. That line of code in Contribution.php looks like this:
  
  ```
    return array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']);
  
  ```
  
  I changed it to this:
  
  ```
    return (array_key_exists() ? array($pageValues['receipt_from_name'], $pageValues['receipt_from_email']) : array(' ', $pageValues['receipt_from_email']));
  
  ```
  
  Is this the right thing to do? I have just registered for the CiviCRM site, if that is the correct place to post something like this. Any other suggestions?
  
  Oh, and there is a typo on line 4730:
  
  ```
  // Use input valuse if supplied.
  
  ```
  
  **Tags:** drupal, civicontribute
  
  > **Comments:**
  > **username_1**: Welcome username_0, can you tell us what version of the CiviCRM you are using? Thanks for reporting the typo in the comment. It's not advisable to edit the CiviCRM code directly but did your edit solve the issue? Consider browsing the Issue Tracker or filing a report: https://issues.civicrm.org/jira/projects/CRM/issues/CRM-20800?filter=allopenissues  
  > **username_0**: I am using 4.7.27, and the change in code did make the warning go away. I've just registered for civicrm.org, and I'll attempt to file a report there.  
  
  ---
  
  ## 0 answers
  
  