Forums

Send email only TO "Special Fields.Email fiel

BandcaveMan 03 Oct, 2007
RE: Version 2.3.4 (I dloaded 2.3.4 and installed successfully but on the components section on Joomla backend is says version 2.3.2 and dated 16.09.2007)

My question:

Is it possible to only send email to the variables entered in the Special Fields tab without also sending to the "Email Address(es)" field on the General tab?

I want to prevent the email from having 2 address in the TO: field of the email.

What I want is this:

After a form is submitted then an email goes TO "Special Fields.Email field:" and BCC "Special Fields.BCC field:".
Currently it is now doing this but also adding the address in "General.Email Address(es):" to the TO field in the email.

I do not want to disclose the additional recipient from the General tab in the TO field of the email.

Any thoughts or solutions?

BandcaveMan
www.bandcave.com<br><br>Post edited by: BandcaveMan, at: 2007/10/03 19:45
GreyHead 04 Oct, 2007
Hi BandCaveMan,

Try just leaving the General tab Email Address(es) field blank. I think this should do what you want.

Bob
BandcaveMan 04 Oct, 2007
Thanks for the reply.

I tried leaving it blank on the general tab, but when selecting Yes for Email Results: and then saving, I get a popup msg box stating that if I choose to email results I have to add an email address on the General tab.
GreyHead 04 Oct, 2007
Hi BandCaveMan,

Ah, OK. I'll check the code and see if I can find a fix for you.

Bob
GreyHead 04 Oct, 2007
Hi BandcaveMan,

As a work-around you can edit admin.chronocontact.html.php and comment out lines 97 to 102 like this:
// do field validation
if ( (form.name.value == '') || (form.name.value.search(/ /) > -1) ) {
  alert( "Please enter the form name without any spaces" );
/** START: comment out this block
} elseif ( form.emailresults.value == '2' ) {
  if ( (form.extraemail.value == '') || (form.emailsubject.value == '') || (document.getElementById('paramsfrom_email').value == '') || (document.getElementById('paramsfrom_name').value == '')) {
    alert( "If you choosed to email results then you must add : Email Address, Email subject, From Name and From Email" );
  } else {
    submitform( pressbutton );
  }
  END: down to here */
} else {
  submitform( pressbutton );
} 


Bob

Post edited by: GreyHead, at: 2007/10/04 07:54<br><br>Post edited by: GreyHead, at: 2007/10/04 07:54
BandcaveMan 04 Oct, 2007
Thanks Bob, I had seen that code yesterday and wondered if it could be commented out but wasn't sure of any side effects.

I'll give it a shot.

btw, ChronoForms is the best! It installed very easily, it is very easy to work with and it even sets up a table to store your data, and it has excel backup. This was exactly what I was looking for, I'm glad I found it. The developers did a great job and your help on this forum was quick and precise. Thank you!🙂

BandcaveMan
www.bandcave.com
GreyHead 04 Oct, 2007
Hi BandcaveMan,

I guess the possible side effects are that someone completes the form without any addresses and you get some junk data - but that's not really any different.

Thanks for the thanks, much appreciated.

Bob
BandcaveMan 05 Oct, 2007
I tried your suggestion but it did not work, no email was sent out. I found a problem though. In the following code located in Chronocontact.php, the $recipient value is supposed to be substituted with a value from $paramsvalues->emailfield but instead, the $recipient array is appended with $recipient[] = $_POST[$paramsvalues->emailfield]

It should be substituted rather than appended, right?

Shouldn't the $recipient array be unset first? The way it is written here is that it will email the address(es) from the "General" tab as well as the fields(email addresses) entered in the "Special fields" tab, which is undesirable.

case 2:
	        default:
	            /**
	             * E-mail the results - 'Yes' custom
	             */
	            if ( $debug) { echo "E-mail: 'Yes' custom<br />"; }
	            $from      = $paramsvalues->from_email;
	            $fromname  = $paramsvalues->from_name;
	            $subject   = $rows[0]->emailsubject;
	            $recipient = str_replace(" ","",$rows[0]->extraemail);
	            $recipient = explode(",", $recipient);
				if(trim($paramsvalues->ccemail)){
					$ccemails = str_replace(" ","",$paramsvalues->ccemail);
					$ccemails = explode(",", $ccemails);
				}else{
					$ccemails = NULL;
				}
				if(trim($paramsvalues->bccemail)){
					$bccemails = str_replace(" ","",$paramsvalues->bccemail);
					$bccemails = explode(",", $bccemails);
				}else{
					$bccemails = NULL;
				}
				if(trim($paramsvalues->replyto_email)){
					$replyto_email = str_replace(" ","",$paramsvalues->replyto_email);
					$replyto_email = explode(",", $replyto_email);
				}else{
					$replyto_email = NULL;
				}
				if(trim($paramsvalues->replyto_name)){
					$replyto_name = str_replace(" ","",$paramsvalues->replyto_name);
					$replyto_name = explode(",", $replyto_name);
				}else{
					$replyto_name = NULL;
				}
	            break;
	    }
	    //$replyto   = $chronocontact_params->get('replyto_email');
        /**
         * Substitute field values if they are set
         */
	    if ( trim($paramsvalues->subjectfield) != "" ) {
	        $subject       = $_POST[$paramsvalues->subjectfield];
	    }
	    if ( trim($paramsvalues->fromemailfield) != "" ) {
	        $from          = $_POST[$paramsvalues->fromemailfield];
	    }
	    if ( trim($paramsvalues->fromnamefield) != "" ) {
	        $fromname      = $_POST[$paramsvalues->fromnamefield];
	    }
	    if ( trim($paramsvalues->emailfield) != "" ) {
	        $recipient[]   = $_POST[$paramsvalues->emailfield];
	    }
		if ( trim($paramsvalues->ccfield) != "" ) {
	        $ccemails[]   = $_POST[$paramsvalues->ccfield];
	    }
		if ( trim($paramsvalues->bccfield) != "" ) {
	        $bccemails[]   = $_POST[$paramsvalues->bccfield];
	    }
Max_admin 05 Oct, 2007
Hi BandcaveMan,

Ok, Before
$recipient[]   = $_POST[$paramsvalues->emailfield];


please add :
unset($recipient);
$recipient = array();

:)

Cheers

Max
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
BandcaveMan 05 Oct, 2007
Let me tell ya! This component is so cool! After unsetting the array it sends email only to the fields on the Special Fields tab. I just enter any email address on the General Tab just to satisfy the validation code.

It works perfect for my application. Thanks.

BandcaveMan
laurel 20 Oct, 2007
Could someone summarize the steps needed to send only to the Special fields? Do we need to do that part about validation? Or just Max's patch above? Thanks.
This topic is locked and no more replies can be posted.