FORUMS: list search recent posts

Problem with PHP Script Driven by Contact Form

COW Forums : Web Design

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>

Bruce MacKownProblem with PHP Script Driven by Contact Form
by on Aug 12, 2010 at 9:50:54 am

Using a tutorial I found on Youtube, I developed a contact form for my website and a separate page with php script to produce an email to the webmaster when a visitor completes and submits the contact from.

Unfortunately I'm getting an error message every time I try to test, and after googling the error message, which is ""warning: mail() [function.mail]: SMTP server response: 451 See http://pobox.com/~djb/docs/smtplf.html." I see that other people are having the same problem but I can't find a solution that works.

One coincidence (or not) is we're all hosted by godaddy.com.

I'm not putting the actual PHP code because I don't know if this is the right forum for this problem.

Anyone got any ideas?

Thanks.

Bruce


Return to posts index

Abraham ChaffinRe: Problem with PHP Script Driven by Contact Form
by on Aug 12, 2010 at 4:04:49 pm

Hello Bruce,

According to this webpage:
http://www.theerrormessage.com/2007/12/warning-mail-smtp-server-response-45...
The problem is the line feed character on Windows. Take a look at that page and see if it helps.

Abraham


Return to posts index

Bruce MacKownGodaddy Says Switch From Linux to Windows
by on Aug 12, 2010 at 11:44:41 pm

Abraham,

I just got off the phone with Godaddy tech support.

He said the send email POST function I'm using doesn't work on their Windows server unless I use their preformatted PHP script.

He said that my script would work fine on their Linux server, and since it's free to switch and only a few hours I told him to switch my website over to one of their Linux servers.

Any thoughts on this matter?

Thanks for your help!.

Bruce


Return to posts index



Abraham ChaffinRe: Godaddy Says Switch From Linux to Windows
by on Aug 13, 2010 at 2:35:48 pm

I prefer Linux servers over Windows servers so I say go for it.

Abraham


Return to posts index


Richard WilliamsRe: Problem with PHP Script Driven by Contact Form
by on Aug 12, 2010 at 7:59:33 pm

Yes, you are in the right place and posting the code here would help and is ok to do

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Bruce MacKownHere's the PHP code that results in an error (on godaddy)
by on Aug 12, 2010 at 11:09:48 pm

Richard,
At your request, here is the PHP code that's giving me problems:

<?php

/* Subject and Email Variables */

$emailSubject = 'Contact Form Forwarded From The Moto Channel';
$webMaster = 'myname@hotmail.com';

/* Gathering Data Variables */

$emailField = $_POST['email'];
$nameField = $_POST['name'];
$subjectField = $_POST['subject'];
$motorcycleField = $_POST['motorcycle'];
$commentsField = $_POST['comments'];
$newvideonotificationField = $_POST['newvideonotification'];

$body = << Email: $email
Name: $name
Subject: $subject
Motorcycle You Ride: $motorcycle
Comments: $comments
New Video Notification: $newvideonotification
EOD;

$headers = "From: $email\r\n";
$headers .= "Content-type: text/html\r\n";
$success = mail($webMaster, $emailSubject, $body, $headers);

/* Results Rendered as HTML */

$theResults = <<



Thank you for contacting us. We will respond to you as soon as we can. You will return to The Moto Channel in a few seconds.




EOD;
echo "$theResults";



?>

Richard, for some reason Creative Cow is cutting off some of my code, I can see that it did it in the preview post, which I guess will just confuse things.

line with $body = << is actually $body = <<
Anyway, the error is at line 29, which starts with $success.

Worth mentioning, when I take $body out of that line, leaving the other three, the error disappears and the email is sent (minus the most important part, the $body part).

Your colleague Abraham on this thread suggested a link, where you can see someone with the same code (because he probably got it from the same tutorial video on Youtube) and the same error message as me (he's hosted by godaddy too), but the suggestions for him did not work for me.

Everybody else on that link had the error message because they needed to replace \n with \r\n, well that's not an option for me because I don't have just \n in my code, only \r\n.

Any suggestions?

Thanks for all you help.

Bruce


Return to posts index



Bruce MacKownGodaddy Says Switch To Linux from Windows
by on Aug 12, 2010 at 11:43:09 pm

Richard,

I just got off the phone with Godaddy tech support.

He said the send email POST function I'm using doesn't work on their Windows server unless I use their preformatted PHP script.

He said that my script would work fine on their Linux server, and since it's free to switch and only a few hours I told him to switch my website over to one of their Linux servers.

Any thoughts on this matter?

Thanks for your help!.

Bruce


Return to posts index

Richard WilliamsRe: Godaddy Says Switch To Linux from Windows
by on Aug 13, 2010 at 1:10:33 am

Sounds about right... Unless you are using ASP or other windows based systems its best to use linux IMO

Richard Williams
p.s. Please remember to rate our post replies and tick if solved. Also, please remember that we here are NOT employed by Adobe, we do this out of love and fun, so its always nice to recieve a Please and Thank You! :o)


Return to posts index

Jim MilinaRe: Godaddy Says Switch To Linux from Windows
by on Jul 4, 2011 at 11:49:29 pm

i'll thank you Richard.

you and ALL the Creative Cow forum moderators/contributors do a GREAT job and provide informative, ACCURATE advice!

thank again, AND again!

...jim

Jim Milina
Little River Media


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]