Buy Now
Sign in

When CC or BCC has address that is in "TO" , mail sending fails.

twhite , December 30 2017, 16:45
T
twhite 41
December 30 2017, 16:45 #374307
Running Chromoforms 6.0.15 on Joomla 3.8.3. In globals, I have "PHP mail" chosen, but also get same result when choosing "sendmail". Platfrom host is InMotionHosting.com.

After Form submit, there is email action after a successful "Curl". An email is sent to the form submitter. Static CC and/or BCC are set in the Email action. If the email address in the "TO" field is also set in email action as CC or BCC then the send fails, with "PHP mail" or "Sendmail" configured. As long as "TO" email is not listed in "CC" or "BCC" then sending is successful.

Evidently "SMTP" configuration works on my localhost, but "PHPmail" or "sendmail" doesn't work on server. Any further information I can give please let me know.

thanks


[email21] => Array
(
[recipients] => Array
(
[0] => p@gmail.com
)

[subject] => GVP Corrections Entry
[body] => <h2>GVP Editorial Revision Tracking</h2>
<h3>* Submission completed *</h3>
<p><strong>Thanks for your input!</strong></p>

<table width="100%" cellpadding="5" cellspacing="3" border="0" class="ui table"><tr><td width="30%" valign="top" align="right"><strong>Name:</strong></td><td width="70%" valign="top" align="left">Joe Test</td></tr><tr><td width="30%" valign="top" align="right"><strong>Email:</strong></td><td width="70%" valign="top" align="left">p@gmail.com</td></tr><tr><td width="30%" valign="top" align="right"><strong>Verify Email:</strong></td><td width="70%" valign="top" align="left">p@gmail.com</td></tr><tr><td width="30%" valign="top" align="right"><strong>Publication Title:</strong></td><td width="70%" valign="top" align="left">Butter Thief</td></tr><tr><td width="30%" valign="top" align="right"><strong>Publication Version:</strong></td><td width="70%" valign="top" align="left">ver 1</td></tr><tr><td width="30%" valign="top" align="right"><strong>Issue Title:</strong></td><td width="70%" valign="top" align="left">Just a test</td></tr><tr><td width="30%" valign="top" align="right"><strong>Issue Description</strong></td><td width="70%" valign="top" align="left">Edition: ver 1.<br />
just a test, please ignore</td></tr></table>
[from_name] => GVP Corrections Entry
[from_email] => webservants@XXX.com
[reply_name] => GVP Site Admin
[reply_email] => webservants@XXX.com
[cc] => Array
(
[0] => p@gmail.com
)

[result] => the Mail could not be sent.
[var] =>
)

admin 28
December 30 2017, 17:59 #374308
Hi twhite,

I would say this is a server config and Chronoforms can not do anything about it.

Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
T
twhite 41
December 31 2017, 17:22 #374327
 1
Hi Max,

Thanks for your quick response.
It looks like it is in joomla code:
libraries/vendor/phpmailer/phpmailer/class.phpmailer.php
around line 935. I am hitting the false return when adding "bcc" when "to" has already been added with same email as "bcc".
If you use "php mailer" you should also be able to hit it.
Basically this means if you create a form and BCC yourself in the Email action, and then submit as yourself, the Email action will fail.


if ($kind != 'Reply-To') {
if (!array_key_exists(strtolower($address), $this->all_recipients)) {
array_push($this->$kind, array($address, $name));
$this->all_recipients[strtolower($address)] = true;
return true;
}
} else {
if (!array_key_exists(strtolower($address), $this->ReplyTo)) {
$this->ReplyTo[strtolower($address)] = array($address, $name);
return true;
}
}
return false;
}
T
twhite 41
January 01 2018, 16:31 #374336
 1
 Answer
My solution:
In libraries/cegcore2/libs/mail.php
right before line 125, I placed the following code and tested, it works.

  // phpmailer will make lowercase but we need earlier for comparison of addresses
  $this->to = array_map( 'strtolower', $this->to );
  $this->cc = array_map( 'strtolower', $this->cc );
  $this->bcc = array_map( 'strtolower', $this->bcc );

  // take out duplicates in bcc and then cc.
  $this->bcc = array_diff( $this->bcc, $this->to, $this->cc );
  $this->cc = array_diff( $this->cc, $this->to, $this->bcc );
admin 28
January 15 2018, 15:59 #374591
Hi twhite,

Thank you for posting the solution!

Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
T
twhite 41
March 15 2018, 05:10 #376122
Hi Max,
It looks like this fix has not been included in Chronoforms_V6.0.17_Extension.zip.
When might it be included in future update?
thanks,
Tom
T
twhite 41
June 17 2018, 13:44 #378388
Hi Max, Bob,
What more evidence do you need to recognize this issue as a legitimate issue?
I have same issue when I upgraded to Version 6.0.18 .
I am hosted on latest hosting solutions with InMotionHosting.com and running latest Joomla version 3.8.8 .
My fix does work. Please let me know what more evidence you need to include it in Chronoforms 6.0.19?
thanks,
Tom
P
pixelhexe 75
April 18 2019, 12:33 #386130
Issue still isn't fixed. Thank you so much for your solution, Tom! I run into similar problem with dynamic to and dynamic bcc.
T
twhite 41
April 18 2019, 15:57 #386137
Piexlhexe, thanks for confirming that this is still outstanding bug.
What I do is save a copy of libraries/cegcore2/libs/mail.php with my fix and every time I update, I compare to new one, and then copy over my fix.
I would hope that after 16 months the fix would be included .... but I understand they must be busy with other issues...
admin 28
April 19 2019, 11:58 #386160
Thank you very much, fix added to the next update!
Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
healyhatman 8
April 20 2019, 22:03 #386167
Careful with the fix though Max, how do you decide which field to strip the duplicate out of?
Also any more thoughts on the suggestion I made a while ago, to add checks and debug messages to the CF mailing action instead of just Joomla's unhelpful true/false?
Web developer at SkySpider.com.au - I DO NOT work for ChronoEngine!
Donations: paypal.me/healyhatman
Professional Work: kamron@skyspider.com.au
Custom CF / CC Plugins and Extensions: skyspider.com.au/store
admin 28
April 21 2019, 15:46 #386170
 1
The same code above is used, priority for the TO then BCC then CC
The action checks for empty recipients/body/subject, but other than this its not possible to get the rejection reason.
Best regards
Max
If your main question got answered then please mark the answer using the button!
Please let us know if you have any problems with the new forums text editor, we appreciate your feedback!
P
pixelhexe 75
April 25 2019, 11:17 #386294
 1
Thank you so much, Max!
@Tom -
in case you didn't notice yet: your fix is included in ChronoForms V 6.1