html form to send email by php file -- broken link error

At my wits end with this. Was getting “cannot display file -HTTP550” error msg so I moved php file to the “cgi-bin” directory. Now I’m getting a “broken link” google msg.

html form tag:

<FORM action="../cgi-bin/mailtest.php" method="post" enctype="text/plain" onSubmit="return checkForm(this);">

php file:
[php]<?php

{
Warning: mail() [function.mail]: SMTP server response: 553 5.3.0 … DISCARD Spam Relay in \\HOSTING\DFS\20\9\8\5\2043295589\user\sites\marshallphotographic.com\www\phpmail.php on line 10
}

ini_set(“sendmail_from”,"[email protected]");
$toaddy = "[email protected]";
$fromaddy = "[email protected]";
$msgsubj = “testing phpmail”;
$msgbody = “This email was sent using the PHP mail() function. If you received this email than the PHP mailer is working fine.”;
if (mail($toaddy, $msgsubj, $msgbody, “From: $fromaddy”))
{

	header( "Location: http://www.tristatecasinoparties.com/index.htm" ) ; }

else

	{ header( "Location: http://www.tristatecasinoparties.com/blackjack.htm" ) ; }

?> [/php]

You were getting the 500 error because you are missing a closing } for your if statement:

[php]
if (mail($toaddy, $msgsubj, $msgbody, “From: $fromaddy”))
{
[/php]

I don’t see where brace is missing.

[php]
if (mail($toaddy, $msgsubj, $msgbody, “From: $fromaddy”))
{

	header( "Location: http://www.tristatecasinoparties.com/index.htm" ) ; }

else

	{ header( "Location: http://www.tristatecasinoparties.com/blackjack.htm" ) ; }

?>
[/php]
You need another } before ?>

I got no error with this code. I changed the to email address, however, I did not receive an email…

[php]<?php
{
Warning: mail() [function.mail]: SMTP server response: 553 5.3.0 … DISCARD Spam Relay in HOSTINGDFS209852043295589usersitesmarshallphotographic.comwwwphpmail.php on line 10
}

ini_set(“sendmail_from”,"[email protected]");
$toaddy = “[email protected]”;
$fromaddy = "[email protected]";
$msgsubj = “testing phpmail”;
$msgbody = “This email was sent using the PHP mail() function. If you received this email than the PHP mailer is working fine.”;
if (mail($toaddy, $msgsubj, $msgbody, “From: $fromaddy”)) {
header( “Location: http://www.tristatecasinoparties.com/index.htm” );
} else {
header( “Location: http://www.tristatecasinoparties.com/blackjack.htm” ) ;
}

?>

[/php]

[php]
if (mail($toaddy, $msgsubj, $msgbody, “From: $fromaddy”)) {
[/php]

What’s with the ?

Also check spam. And make sure there is a sendmailer installed, and if using a free-host that you can use mail()

I removed the if then statement and the message went through… I am not sure that mail() will return a true value or not so you may have to define some variable to test then send the mail if true and redirect after.

http://php.net/manual/en/function.mail.php

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.

The warning at the top seems to be the issue, after I removed this it worked.

[php]{
Warning: mail() [function.mail]: SMTP server response: 553 5.3.0 … DISCARD Spam Relay in HOSTINGDFS209852043295589usersitesmarshallphotographic.comwwwphpmail.php on line 10
}
[/php]

Sponsor our Newsletter | Privacy Policy | Terms of Service