Jump to content

Simple mail script not working...


ethayne

Recommended Posts

Hi all,

 

I've got a simple mail script here for an html form. Everything seems to be working correctly except the actual mailing part. Here is the site for reference: http://www.littlesproutandco.com/splash

 

PHP script:

<?php

$email=$_POST['email'];
$body="The email address $email wants to be notified when the Little Sprout and Company website is finished!";

if ($email) {

mail("[email protected]","Little Sprout Sign Up",$body,"From:LittleSprout")

header("Location: success.php");

}

else {
header("Location: index.php");
}

?>

 

Any idea what's going on?

Thanks!

 

Link to comment
https://forums.phpfreaks.com/topic/127338-simple-mail-script-not-working/
Share on other sites

Do they not allow you to set you SMPT in the ini? I've had that problem with one server I was working with.

I am just wondering because I have a few times told people to use them though I've never once used the myself, I just hear they are good for people just looking for a simple, user friendly host.

If the mail() function has issues, that may ward me off from their serviced in the future. :-\

function sendMail($to, $subject, $message) {

 

$headers = "From: SNT CMS <[email protected]>\r\n" .

      'X-Mailer: PHP/' . phpversion() . "\r\n" .

      "MIME-Version: 1.0\r\n" .

      "Content-Type: text/html; charset=utf-8\r\n" .

      "Content-Transfer-Encoding: 8bit\r\n" .

  "Content-type: text/html; charset=iso-8859-1\r\n";

 

// Send

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

if ($mailing != false) {

return true;

}else{

return false;

}

}

 

 

i use this homemade thing - enjoy

use like so:

 

<?php

$email = '[email protected]';
$subject = 'Hello!';
$message = 'I <3 PHP';

$mailing = sendMail($email, $subject, $message);

if($mailing == false){
//error capture
}else{
//success capture
}
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.