thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
Two functionality questions
Hello,
I installed PHPMailer-FE (along with class.phpmailer.php) last week, to serve as the basis for a new set of contact forms between my company and a
call center service we use for customer support calls. I may have found a couple bugs when enabling certain settings in the default.config.php file
(which I will post when I know for sure), but overall the functionality is wonderful...certainly several times better than the BNBScript form that our
web hosting company suggested.
I will be working with the script for the next couple days and may figure this stuff out on my own, but decided to post here, too. I have two
questions about functionality:
1) When used with class.phpmailer.php, is it possible to send a combination plain text/HTML email, for maximum readability?
2) When using the "email" form field to send a copy of the request to the submitting party, is it possible to include multiple email addresses
(separated by commas, etc.)? I'm not looking to put multiple addresses into the actual form, but to concatenate them through Javascript, as part of
the submission process. Will something in the script itself stop me?
Thanks!
Todd
|
|
|
andy.prevost
|
|
1) yes, that is the default - sends both text/HTML
2) you can define multiple email addresses in the config file - suggest you use BCC and not TO so they get individual emails.
By the way, welcome to PHPMailer-FE. Hope you enjoy it.
Andy
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
Recipient vs. Email fields?
Thanks for the comments, Andy. I am beginning to wrap things up, but something has me puzzled. So, another functionality question...? In this setup
where I have a "replyemailsuccess.html" file configured, the email address in "recipient" is receiving both the contents of the form (currently in the
default HTML table format) AND a copy of replyemailsuccess.html. Just now I tried adding
$_POST['email'] = ''
to the default.config.php file, but PHPMailer-FE choked with a "your email address is invalid" error.
How do I configure PHPMailer-FE to send us the form contents only? Then my next step will be to make sure the name="email" field is handled properly,
per my first question.
Thanks!
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
A followup. Through some trial and error, it appears the email form field cannot be blank, and PHPMailer-FE copies the contents of "recipient" if
necessary. I can work around this with something like
if ($_POST['email'] == '')
$_POST['email'] = 'email@foo.com';
in the default.config.php file.
Back to my first question, I cannot seem to place multiple email addresses (separated by commas) into the email form field. One email addresses
works, but two causes the
Sorry! your submission failed.
The form was not submitted for the following reasons:
your email address is invalid
error. What I have is a list of various contact methods (phone numbers, fax numbers, email addresses, etc.) and an additional text input field for
manually adding a contact method that is not on the list. So there is not a single field named "email". Instead, I am parsing the user's input and
populating "email" dynamically using Javascript. I thought that formatting the addresses the way they appear in the default.config.php for CC: and
BCC: would work, but it isn't so far.
Have my guesses been correct? Is there something I'm missing? Andy, I appreciate any suggestions.
Thanks again!
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
On re-reading your first reply, I realized that multiple "email' recipients isn't likely meant to work.
This being the case, the only workaround I see is to swap the meanings of the recipient, cc, and bcc fields with the email field. This way, "email"
would go to us, and its email address and contents would be unseen by the customer. Recipient (or at least, cc and bcc) CAN handle multiple email
addresses, and would go to the customer. But this is starting to get messy.....
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
I decided to take the other tactic and disable the _validateEmail function. but now even though I can add multiple To: addresses, the messages are
silently not sent. A single email address still works. (I don't think CC or BCC would do, as these work only in conjunction with the "recipient"
field, correct?) And we are using a hosted web service, so whatever error is being generated, I don't have easy access to. But PHPMailer is
advertised as "supports emails with multiple TOs, CCs, BCCs and REPLY-TOs" so I'm still confused.
Apologies for all the rambling...
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
Ah, I finally had a look at the mail_it function and rewrote a small portion, and now my multiple TO: addresses are working. Our web page will be
password protected, so while this change could have an adverse affect on security, if anything should happen, we'll know who did it. :)
So to sum up, would you consider the following additions for a future release?
1) If the "email" value is blank, silently fail to send a message.
2) A more organized way to allow either a) multiple email addresses in the TO: field (for "email", for "recipient", or both) or b) an additional
CC:/BCC: field to work alongside "email".
Thanks.
|
|
|
andy.prevost
|
|
It is not the "email" value that is important, that is used to identify the Sender (the person filling in the form).
What you are trying to do is impact the "recipient" value, that is who the form is being sent to.
A simpler solution is to use a switch or if/elseif combination based on form input to determine the recipient(s).
You can do that in default.config.php or in formname.config.php (preferably formname.config.php) ... default.config.php is intended to be a catch
all.
Andy
|
|
|
thetao
Junior Member

Posts: 8
Registered: 8-9-2009
Member Is Offline
|
|
What I've been calling "email" is the name="email" field from the sample form, which I've carried over to a hidden "email" field in my form. What
I've been calling "recipient" is the first variable in the *.config.php file. The "email" portion needs to go to anywhere from 0-3 customer email
addresses, while the "recipient" portion goes to us. "FixedFromEmail" is always the sender. Line 1401 in PHPMailer-FE 4.0.3 (part of mail_it) uses a
single AddAddress to inject the entire contents of "recipient" (now reversed meaning?) into the TO: field. There's no explode, foreach, etc. so I
don't see how some extra programming in *.config.php would work around this. With commas, more than one email address, etc., that single AddAddress
would send PHPMailer an unusable address, no?
Hopefully I don't have all of this backwards already? It does work, and I'm behind schedule, so I'm going to leave things mostly as-is for now.
|
|
|
andy.prevost
|
|
thetao,
email is intended to be the person filling in the form
recipient is intended to be the person receiving the form data
you can also use cc, and bcc.
If you use PHPMailer as a transportation class, the multiple to's can each get individual emails by setting:
$mail->SingleTo = true;
I suggest if you are trying to get the form contents to multiple people, that you use form.config.php and setup something like:
if ($condition == 1) {
$_POST['bcc'] = 'name1@mycompany.com,name2@mycompany.com';
} elseif ($condition == 2) {
$_POST['bcc'] = 'name3@mycompany.com,name4@mycompany.com';
} else {
$_POST['bcc'] = 'name5@mycompany.com,name6@mycompany.com';
}
That will ensure that at least one person (recipient) gets the email, and conditionally, two others will as well, each getting individual emails.
|
|
|
Zaine
Newbie
Posts: 1
Registered: 1-12-2009
Member Is Offline
|
|
I thought that formatting the addresses the way they appear in the default.
Regards
Zainen
|
|
|