From: | Tim B. |
Sent on: | Thursday, August 11, 2016, 9:56 PM |
if(isset($toName) && $toName != "") { In this line, the isset is pointless. $toName is defined in the function declaration as a non-optional parameter and thus will always be set. So if $toName happens to be an empty string, none of your preprocessing is going to happen, and $toEmail ends up being whatever it was when it was passed in. I traced that variable as far as I can in that file and it's just passed around as-is. If you drop a breakpoint on that line, you can use the debugger's call stack (#2 in the link below) to trace your variable back up the chain to its caller to its caller to its caller to its caller to where it was defined. https://confluence... On 8/11/[masked]:02, Monkee Work wrote: > Hi Folks - i’m playing with the mail() function and am trying to send > mail to more then one recipient. I’m giving the function a string as a > parameter as best i know which is what I am suppose to do as best i can > tell from PHP.NET <https://php.net> and other reference sources and I’m > getting a wacky error because i always get wacky errors. This error says > my string is an array and thus making a boo boo. I’ve tried implodes, > explodes and holding my breath and nothing has worked. Hoping for some > help and guidance with this. > > As always thanks (FYI - if i respond wackily, my flu is back and i’m > probably very feverish and apologize - evidently it’s really hot today > not that i can tell as i’m freezing). > > Thanks! > > > > TEST URL: https://marvel-cha... > > The problem seems to be in contact_inc.php > GitBranch: https://github.com... > > MY VAR_DUMP($toMail) > string(40) "[address removed] > <mailto:[address removed]>,[address removed] > <mailto:[address removed]>” > > > > Here is my backtrace: > string(40) "[address removed] > <mailto:[address removed]>,[address removed] > <mailto:[address removed]>" > Error in > file: *'/home/maxster/marvel-champions.com/_inc/contact_inc.php' > <https://marvel-cha...;* on > line: *331* Error message: *mail() expects parameter 1 to be string, > array given* > > BackTrace: > > Array > ( > [0] => Array > ( > [file] => /home/maxster/marvel-champions.com/_inc/config_inc.php > <https://marvel-cha...; > [line] => 211 > [function] => printDeveloperError > [args] => Array > ( > [0] => /home/maxster/marvel-champions.com/_inc/contact_inc.php > <https://marvel-cha...; > [1] => 331 > [2] => mail() expects parameter 1 to be string, array given > [3] => 1 > ) > > ) > > [1] => Array > ( > [function] => myErrorHandler > [args] => Array > ( > [0] => 2 > [1] => mail() expects parameter 1 to be string, array given > [2] => /home/maxster/marvel-champions.com/_inc/contact_inc.php > <https://marvel-cha...; > [3] => 331 > [4] => Array > ( > [toEmail] => Array > ( > [0] => [address removed] <mailto:[address removed]> > [1] => [address removed] <mailto:[address removed]> > ) > > [toName] => Array > ( > [0] => Info > ) > > [subject] => Marvel Champions message from: this, August 11,[masked]:46 pm > [body] => Marvel Champions message from: this, August 11,[masked]:46 pm > > Name: this > > Email: [address removed] <mailto:[address removed]> > > Comments: dsafsf sd > > > [fromEmail] => [address removed] <mailto:[address removed]> > [fromName] => this > [website] => Marvel Champions > [domain] => marvel-champions.com <https://marvel-cha...; > [bccEmail] => > [bccName] => > [debug] => > [headers] => Array > ( > [0] => MIME-Version: 1.0 > [1] => Content-type: text/plain; charset=iso[masked] > [2] => From: this [3] => Reply-To: this [4] => Subject: Marvel Champions message from: > this, August 11,[masked]:46 pm [5] => X-Mailer: PHP/5.6.24 ) [emailArray] > => Array ( ) ) ) ) [2] => Array ( [file] => > /home/maxster/marvel-champions.com/_inc/contact_inc.php > <https://marvel-cha...; [line] => 331 > [function] => mail [args] => Array ( [0] => Array ( [0] => > [address removed] <mailto:[address removed]> [1] => > [address removed] <mailto:[address removed]> ) [1] => Marvel > Champions message from: this, August 11,[masked]:46 pm [2] => Marvel > Champions message from: this, August 11,[masked]:46 pm Name: this Email: > [address removed] <mailto:[address removed]> Comments: dsafsf sd [3] => > MIME-Version: 1.0 Content-type: text/plain; charset=iso[masked] From: > this Reply-To: this Subject: Marvel Champions message from: this, August > 11,[masked]:46 pm X-Mailer: PHP/5.6.24 ) ) [3] => Array ( [file] => > /home/maxster/marvel-champions.com/_inc/contact_inc.php > <https://marvel-cha...; [line] => 109 > [function] => email_handler [args] => Array ( [0] => > [address removed] <mailto:[address removed]>,[address removed] > <mailto:[address removed]> [1] => Info [2] => Marvel Champions message > from: this, August 11,[masked]:46 pm [3] => Marvel Champions message > from: this, August 11,[masked]:46 pm Name: this Email: [address removed] > <mailto:[address removed]> Comments: dsafsf sd [4] => [address removed] > <mailto:[address removed]> [5] => this [6] => Marvel Champions [7] => > marvel-champions.com <https://marvel-cha...; ) ) [4] => Array ( > [file] => /home/maxster/marvel-champions.com/contact.php > <https://marvel-cha...; [line] => 130 [function] => > handle_POST [args] => Array ( [0] => > recaptcha_challenge_field,recaptcha_response_field,Email [1] => 1 [2] => > Info [3] => [address removed] > <mailto:[address removed]> [4] => [address removed] > <mailto:[address removed]>,[address removed] > <mailto:[address removed]> [5] => Marvel Champions [6] => > marvel-champions.com <https://marvel-cha...; ) ) ) > >