I used the simple script from this website and it seemed to work ok except no mail gets sent. I know this script was used for at least two christmases to send mail. Is there a process that I need to run on the server to enable it to send mail because no mail is getting out ????? Im on a deadline for monday, any help would be appreciate!!!


<form method="post" action="sendmail.php">Email:
< input name="email" type="text" />Message:<textarea name="message" rows="10" cols="30">
</textarea><input type="submit" /></form>


<?$email = $_GET ;
$message = $_GET ;
mail( "susie_ewing@rocketmail.com", "Email Subject", $message, "From: $email" );
print "Congratulations your email has been sent";?>


Recommended Answers

All 7 Replies

I suggest that you replace the first and second lines of sendmail.php with:

$email = $_POST['email'];
$message = $_POST['message'];

It is better to use <?PHP rather than just <? because that doesn't work on all systems. Since the first program used method="post" the second one has to get the variables from the $_POST array. Finally, you aren't using the $email variable and I presume that is supposed to contain the email address. If so, then you need to change the mail statement to look like:

mail( $email, "Email Subject", $message, "From: $email" );

I tried it and it was a better script so I put a check on the end of it like so:

And it came back as not sent.

There is some kind of mime setting on the server that requires the server to mimic a mail server or become a mail server.

Its something in the slice. ORRRRRRR..... it could be that this script is configured on the server to only run from the office from certain authorized pcs on the network.

I am trying to run it from home and maybe thats why its not working,.

well something happened! I got spammed with a Viagra message for the first time in my life so someone must have gottn my email off this site and spanned me,...grrrrrrrrrrrrrrrrr

Not a person, there are spiders that surf the web only to collect email addresses.. and yes, there are some additional headers:

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

check the reference for more information: http://php.net/manual/en/function.mail.php


thanks, well I think I also need a .bcc parameter because I have tons of names on the list which is in a semicolon delimieted file. The problem still remains that the script does not send the mail so there is a service on the slice that needs to be initialized but I have no idea what or how to initialize it.

I can suggest only to check with phpinfo() if sendmail_path is empty or not. Bye :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.