Jump to content

Mail Script Problem Solving


WaveLine

Recommended Posts

I'm trying to put together a simple mail script to later integrate with a forum on my website.

 

I'm new to php but I don't see where I went wrong compared to other scripts

 

it's not echoing anything or mailing for that case so does anyone see the problem with the script?

 

please help me correct this it would be very much appreciated.

 

<?php

$name = "Jared Vasquez";
$phone = "(952)415-0294";
$ebudget = "$0.00";
$company = "Wave Line";
$business = "Production";
$from = "love@gmail.com";
$website = "http://waveline.net";
$summary = "A working, well organized php script for emailing variables sent from contact form";



$to = "WaveLine@gmail.com";
$from_header = "From: $from";

//build contents
$contents = "$name\n\r $phone\n\r $from\n\r $ebudget\n\r $company\n\r $business\n\r $website\n\r $summary";
$subject = "$company $name" 

if($contents != "")
{
   mail($to, $subject, $contents, $from_header);
   header("Location: http://waveline.net");
   echo "<HTML><BODY>Sent!";
   echo "</BODY></HTML>";
}
  else
{
   echo "<HTML><BODY>Error";
   echo "</BODY></HTML>";
}
?>

Link to comment
Share on other sites

<?php

 

$name = "Jared Vasquez";

$phone = "(952)415-0294";

$ebudget = "$0.00";

$company = "Wave Line";

$business = "Production";

$from = "love@gmail.com";

$website = "http://waveline.net";

$summary = "A working, well organized php script for emailing variables sent from contact form";

 

 

 

$to = "WaveLine@gmail.com";

$from_header = "From: $from";

 

//build contents

$contents = "$name\n\r $phone\n\r $from\n\r $ebudget\n\r $company\n\r $business\n\r $website\n\r $summary";

$subject = "$company $name"

 

if($contents != "")

{

  mail($to, $subject, $contents, $from_header);

  header("Location: http://waveline.net");

  echo "<HTML><BODY>Sent!";

  echo "</BODY></HTML>";

}

  else

{

  echo "<HTML><BODY>Error";

  echo "</BODY></HTML>";

}

?>

 

 

Try this code:

if(!($contents== ""))

{

  mail($to, $subject, $contents, $from_header);

  header("Location: http://waveline.net");

  echo "<HTML><BODY>Sent!";

  echo "</BODY></HTML>";

}

  else

{

  echo "<HTML><BODY>Error";

  echo "</BODY></HTML>";

}

 

 

or why not try with some arbitrary names:

mail("to@gmail.com","subject","body","From:from@gmail.com");

 

check whether SMTP server is ok!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.