You are here: Re: Can anyone see a problem with this email script? « PHP Programming Language « IT news, forums, messages
Re: Can anyone see a problem with this email script?

Posted by Rami Elomaa on 04/11/07 05:18

Pete Marsh kirjoitti:
> On Apr 10, 3:51 am, Rami Elomaa <rami.elo...@gmail.com> wrote:
>> Pete Marsh kirjoitti:
>>
>>
>>
>>> On Apr 10, 12:47 am, Rami Elomaa <rami.elo...@gmail.com> wrote:
>>>> Pete Marsh kirjoitti:
>>>>> On Apr 9, 2:34 pm, Rami Elomaa <rami.elo...@gmail.com> wrote:
>>>>>> Pete Marsh kirjoitti:
>>>>>>> Wondering if anyone can see an error with this script. I get a server
>>>>>>> configuration error. THat could mean a module is not being loaded, but
>>>>>>> maybe there's a syntax error here, can anyone spot it? Thanks
>>>>>>> <?
>>>>>>> Error_Reporting(E_ALL & ~E_NOTICE);
>>>>>>> $subject="from ".$_REQUEST['Your_Name:'] ;
>>>>>>> $headers= "From: ".$_REQUEST['Your_Email:'] ."\n";
>>>>>>> $headers.='Content-type: text/html; charset=iso-8859-1';
>>>>>>> $message='';
>>>>>>> while ($field = current($_REQUEST)) {
>>>>>>> if ((key($_REQUEST)!="Your_Name:") && (key($_REQUEST)!
>>>>>>> ="Your_Email:") && (key($_REQUEST)!="Message:") && (key($_REQUEST)!
>>>>>>> ="i")) {
>>>>>>> $message.="<strong>".key($_REQUEST)."</strong>&nbsp;&nbsp;&nbsp;".
>>>>>>> $field."<br>";
>>>>>>> }
>>>>>>> next($_REQUEST);
>>>>>>> }
>>>>>>> $message.="<br>".$_REQUEST['Message:'];
>>>>>>> mail($_REQUEST['recipient'], $subject, "
>>>>>>> <html>
>>>>>>> <head>
>>>>>>> <title>Contact letter</title>
>>>>>>> </head>
>>>>>>> <body>
>>>>>>> <br>
>>>>>>> ".$message."
>>>>>>> </body>
>>>>>>> </html>" , $headers);
>>>>>>> echo ("Your message was successfully sent!");
>>>>>>> ?>
>>>>>> Have you tried with the very simplest possible mail? I mean just leave
>>>>>> out all the form shit and custom headers and such and just try:
>>>>>> mail('your_em...@example.com','this is a test', 'Hello Kitty!');
>>>>>> And if you get a server configuration error with that, then it's not a
>>>>>> php problem, it's a configuration problem. If not, you can slowly start
>>>>>> adding the stuff you have above to your mail and then see where it goes
>>>>>> wrong.
>>>>>> BTW. It's not against the law or anything to have colons in field names,
>>>>>> but just to be on the safe side, I wouldn't use them. They serve no
>>>>>> purpouse and it's just not customary to do so. I actually had to test to
>>>>>> see if they really really work, and yes they do, but it's still quite
>>>>>> odd to do so. I was thinking the old "dots are converted to undescores"
>>>>>> trick...
>>>>>> --
>>>>>> Rami.Elo...@gmail.com
>>>>>> "Olemme apinoiden planeetalla."
>>>>> hi yes your basic mail works, so it's something else.
>>>>> it's a very weird set up I've inherited. They have the actual form
>>>>> separated out and embeded in a flash app, so I can't even see it! Then
>>>>> they ahve two separate php scripts, one to handle the form processing,
>>>>> and this one to handle to email respone. but the form processor does
>>>>> not seem to point to this email script. What a mess.
>>>> Well you could try looking at what the form actually passes to the
>>>> script. Put something like this at the very beginning of your mail script:
>>>> file_put_contents('my_mail_log.txt', print_r($_REQUEST, 1));
>>>> Kinda like trap what it's trying to send and try to figure out if
>>>> there's something wrong there, missing parameters or something.
>>>> The form being flash explains the colons though... Flash designers...
>>> Unfortunately, the form is embedded in a flash binary!
>>> I cannot see the source code at this time.
>>> Unbelievable!
>> That's quite alright. That's why I told you to check what the form sends
>> to the mail script. Insert this line at the beginning of the mailer
>> script so you'll see what the flash form sends to the mailer, even if
>> you can't see what is happening inside the flash:
>>
>> file_put_contents('my_mail_log.txt', print_r($_REQUEST, 1));
>>
>> And then try sending mail from the flash application and study the
>> results in my_mail_log.txt.
>
>
> Thanks for these interesting replies.
>
> The script is so bad, I think I'm goign to have to do it again.
> The flash part isn't even done right either, so I have to make a test
> form in any case.

That might just be the best solution :)

--
Rami.Elomaa@gmail.com
"Olemme apinoiden planeetalla."

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация