473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHPMailer Question about using CC in Forms

My form processes the lines below just fine so long as there's
something in the cc field (which I'm trying to leave optional). If the
cc field of the form is left blank, I get an error. I need an if
statement where the cc is optionally blank and the $to still works. As
I have it, the $to line below works well because there's always going
to be an entry however again, the cc won't be used 100% of the time.
I was toying around with the if statement below but don't have it
figured out yet. Any help is appreciated. TIA

$mail->AddAddress($arrEmailAddress[$to]);
$mail->AddCC($arrEmailAddress[$cc]);
----------code below clearly not there yet for the cc field-----------
if ($cc=''''){
$mail->AddCC($cc);
}

Jun 2 '07 #1
3 3225
cover wrote:
My form processes the lines below just fine so long as there's
something in the cc field (which I'm trying to leave optional). If the
cc field of the form is left blank, I get an error. I need an if
statement where the cc is optionally blank and the $to still works. As
I have it, the $to line below works well because there's always going
to be an entry however again, the cc won't be used 100% of the time.
I was toying around with the if statement below but don't have it
figured out yet. Any help is appreciated. TIA

$mail->AddAddress($arrEmailAddress[$to]);
$mail->AddCC($arrEmailAddress[$cc]);
----------code below clearly not there yet for the cc field-----------
if ($cc=''''){
$mail->AddCC($cc);
}
I believe you would want

if ($cc != "") $mail->AddCC($cc);

Jun 2 '07 #2
On Jun 2, 3:58 pm, cover <coverlandNOSPAM...@yahoo.comwrote:
My form processes the lines below just fine so long as there's
something in the cc field (which I'm trying to leave optional). If the
cc field of the form is left blank, I get an error. I need an if
statement where the cc is optionally blank and the $to still works. As
I have it, the $to line below works well because there's always going
to be an entry however again, the cc won't be used 100% of the time.
I was toying around with the if statement below but don't have it
figured out yet. Any help is appreciated. TIA

$mail->AddAddress($arrEmailAddress[$to]);
$mail->AddCC($arrEmailAddress[$cc]);

----------code below clearly not there yet for the cc field-----------
if ($cc=''''){
$mail->AddCC($cc);
}
do you mean?

if( $cc != '' )
{
$mail->AddCC($cc);
}

you could google for "conditionals in php" for more help on using if
statements, but my advice is - if you are this new to php coding, DONT
play with scripts, you could easily create a working spam bot, which
would quickly increase your headaches by many orders of magnitude.

Jun 5 '07 #3
Tom

"shimmyshack" <ma********@gmail.comwrote in message
news:11**********************@q66g2000hsg.googlegr oups.com...
On Jun 2, 3:58 pm, cover <coverlandNOSPAM...@yahoo.comwrote:
My form processes the lines below just fine so long as there's
something in the cc field (which I'm trying to leave optional). If the
cc field of the form is left blank, I get an error. I need an if
statement where the cc is optionally blank and the $to still works. As
I have it, the $to line below works well because there's always going
to be an entry however again, the cc won't be used 100% of the time.
I was toying around with the if statement below but don't have it
figured out yet. Any help is appreciated. TIA

$mail->AddAddress($arrEmailAddress[$to]);
$mail->AddCC($arrEmailAddress[$cc]);

----------code below clearly not there yet for the cc field-----------
if ($cc=''''){
$mail->AddCC($cc);
}

do you mean?

if( $cc != '' )
{
$mail->AddCC($cc);
}

you could google for "conditionals in php" for more help on using if
statements, but my advice is - if you are this new to php coding, DONT
play with scripts, you could easily create a working spam bot, which
would quickly increase your headaches by many orders of magnitude.
If you are using input from a web form to send email, you need to be really
careful that spammers don't hijack your script.

As an example that can submit an email address for the "To" header then add
a whole bunch of other addresses in the CC or Bcc header.

You need to be really careful about checking for conditions like that, such
testing for new line characters, in the form information people are
submitting to you.

Tom
--

Newsguy.com
90+ Days Retention
99% Article Completion
Create Your Own NZB Files


Jun 5 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Leszek | last post by:
Hi. I have problem with phpMailer 1.73 (windows version) After copying both class.phpmailer and class.smtp and also language file phpmailer.lang-pl to my php include directory im getting this...
0
by: SirShurf | last post by:
Hi, I am using a phpmailer class to send some forms over the email... And the problem is, that some ppl (especially problematic for me is the buyer....) getting the email as rough data (sorce...)...
3
by: thehuby | last post by:
Does anyone know how I can send an email using PHPMailer (or similar) and have it send 'on behalf of' someone. This is for a tell a friend feature on a website (I am trying to mimic the way that...
1
by: crescent_au | last post by:
I am developing a simple mailing system. This requires sending emails in HTML format to one or more recipient. I am currently using PHP's mail() function. It works alright but it doesn't seem...
2
by: prasenjit2007 | last post by:
Hello, can u help me sending Email with attachments using the Class phpMailer. On the website I have a link to an html form in which I input the parameters with the names 1)from(textbox name)...
9
by: Lucanos | last post by:
Hi All, I am currently using PHPMailer to send out a set of emails on the execution of a PHP Script (obviously). My problem is that the PHPMailer action is returning a "true" result each time...
5
by: Gilles Ganault | last post by:
Hello To handle an occasionnal flaky ADSL connection, I updated the database that handles incoming calls to have a column that is set to NULL, and then updated to either Y or N depending on...
4
by: mukeshrasm | last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini...
0
by: mukeshrasm | last post by:
Hi! I want to use phpmailer class to send mail using smtp.I have downloaded the phpmailer and then i followed it's README file where it is mentioned that "Copy class.phpmailer.php into your php.ini...
5
by: jeddiki | last post by:
I am building my subscriber list which is held in the mySQL database "client" table and I want to start sending them a newsletter. My list will probably get up to around 20,000 I would like...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.