Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

nuSendEmail: CC and BCC removed?

Questions related to using nuBuilder Forte.
Post Reply
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

nuSendEmail: CC and BCC removed?

Unread post by kev1n »

Hi,

While updating a nuBuilder Forte project to the latest version, I noticed that emails do no reach the recipients that are in CC and BCC anyomore. Taking a closer look at the function nuSendEMail(), I noticed that although nuSendEmails takes a CC and BCC parameters, nuEMail() doesn't.
Is there a reason for that? While I'm waiting for an answer, I'll modify the function so that CC and BCC work again.

Code: Select all

function nuSendEmail($to, $from, $fromname, $content, $subject, $filelist, $html = false, $cc = "", $bcc = "", $reply_to_addresses = array()) {
	// nuSendEmail function is being retired and replaced with nuSendEmail
	$to_list	= explode(',',$to);
	return nuEmail($to_list,$from,$fromname,$content,$subject,$filelist,$html,$reply_to_addresses);
}
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: CC and BCC removed?

Unread post by kev1n »

I made the following changes to make CC and BCC work again:

nucommon.php:

Code: Select all

function nuSendEmail($to, $from, $fromname, $content, $subject, $filelist, $html = false, $cc = "", $bcc = "", $reply_to_addresses = array()) {

	// nuSendEmail function is being retired and replaced with nuSendEmail
	$to_list	= explode(',',$to);
	$cc_list	= explode(',',$cc); // added
	$bcc_list	= explode(',',$bcc); // added
	// return nuEmail($to_list,$from,$fromname,$content,$subject,$filelist,$html,$reply_to_addresses); // removed
	return nuEmail($to_list,$from,$fromname,$content,$subject,$filelist,$html,$cc_list, $bcc_list,$reply_to_addresses); // added
}
nuemailer.php

Replace:

Code: Select all

// function nuEmail($to_list=array(),$from_address='',$from_name='',$content='',$subject='',$file_list=array(),$html=false,$reply_to_list=array(),$debug=0,$method='SMTP')  // removed
With

Code: Select all

function nuEmail($to_list=array(),$from_address='',$from_name='',$content='',$subject='',$file_list=array(),$html=false,$cc_list=array(), $bcc_list=array(), $reply_to_list=array(),$debug=0,$method='SMTP')  // changed
and add after: _nuEmailHelperAdd($mail, $nuEmailSettings->reply_to_list, 'AddReplyTo');

Code: Select all

       
_nuEmailHelperAdd($mail, $cc_list,                              'AddCC'); // added
_nuEmailHelperAdd($mail, $bcc_list,                             'AddBCC'); // added
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: CC and BCC removed?

Unread post by admin »

kevin,

Your changes are in the next release coming soon.

Please test them for me.


Steven
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: CC and BCC removed?

Unread post by kev1n »

Steven, this also needs to be added to _nuEmailHelperAdd() to make it work.
kev1n wrote:
and add after: _nuEmailHelperAdd($mail, $nuEmailSettings->reply_to_list, 'AddReplyTo');

Code: Select all

       
_nuEmailHelperAdd($mail, $cc_list,                              'AddCC'); // added
_nuEmailHelperAdd($mail, $bcc_list,                             'AddBCC'); // added
helper.PNG
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: CC and BCC removed?

Unread post by admin »

kev1n,

Can you attached a working file?


Steven
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: CC and BCC removed?

Unread post by kev1n »

Steven,

Here you go.
nuemailer.zip
You do not have the required permissions to view the files attached to this post.
admin
Site Admin
Posts: 2815
Joined: Mon Jun 15, 2009 2:23 am
Been thanked: 25 times

Re: nuSendEmail: CC and BCC removed?

Unread post by admin »

kev1n,

It is live now on https://github.com/steven-copley/nubuilder4.

If you can test it and everything is fine, I'll put it on SourceForge.


Thanks, Steven
kev1n
nuBuilder Team
Posts: 4307
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 448 times
Contact:

Re: nuSendEmail: CC and BCC removed?

Unread post by kev1n »

Steven, CC und BCC works fine. I've been using it in production for more than 2 weeks.

I would be glad if you could shed a light on this matter:

nuSendEmail: $from, $fromname ignored?

https://forums.nubuilder.cloud/viewtopic.php?f=19&t=10086
Post Reply