PHP Mail Function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

PHP Mail Function

Post by DenKain »

I have no idea why this code will not work. Everything looks as if it was posted correctly and the mail() looks as if it is filled out correctly. Maybe I just need a second pair of eyes.

Code: Select all

 
<html>
<body>
 
<?php
if (isset($_REQUEST['surveyBoS']))
//if "surveyBoS" is filled out, send email
  {
  //send survey
  $OS = $_REQUEST['OS'] ; 
  $basicOptions = $_REQUEST['basicOptions'] ;
  $subject = "Survey - BoS" ;
  $additionalFeatures = $_REQUEST['additionalFeatures'] ;
  $moneyAmount = $_REQUEST['moneyAmount'] ;
  $catalogingSystem = $_REQUEST['catalogingSystem'] ;
  $securityFeatures = $_REQUEST['securityFeatures'] ;
  mail( "admin@mythicsoftware.com", "$subject",
  "OS: $OS, Basic Options they would like to see: $basicOptions, Additional Features: $additionalFeatures, Security Features: $securityFeatures, How much would you pay?: $moneyAmount, Cataloging System: $catalogingSystem", "From: doNotReply@mythicsoftware.com" );
  echo "Thank you for using our mail form";
  }
else
//if "surveyBoS" is not filled out, display the form
  {
  echo "<form method='post' action='surveyBoS.php'>
  1. What Operating System do you use?: 
     <br />
       <input name='OS' type='radio' value='Windows Vista'/>Windows Vista
     <br />       
       <input name='OS' type='radio' value='Windows XP'/>Windows XP
     <br />
       <input name='OS' type='radio' value='Windows Me'/>Windows ME
     <br />
       <input name='OS' type='radio' value='LinuxRPM'/>Linux with RPMs
     <br />
       <input name='OS' type='radio' value='LinuxDEB'/>Linux with DEB
     <br />
       <input name='OS' type='radio' value='Unix'/>Unix
     <br /><br />
  2. What basic options would you like to see in a Book of Shadows program for your computer- i.e. chapter divisions,  book      formats/styles, tutorials, multi-lingual capabilities?: 
     <br />
      <textarea name='basicOptions' rows='15' cols='40'>
      </textarea>
     <br /><br />
  3. What additional features would make your Book of Shadows program more personal and meaningful for you? For example,    
     picture and art tools, belief-specific background and themes, stylized fonts, file sharing capabilities, etc.: 
     <br />
      <textarea name='additionalFeatures' rows='15' cols='40'>
      </textarea>
     <br /><br />
  4. Would you like security features to protect the privacy of your Book of Shadows, such as password hashing, password    
     protections for specific users, journal entry encryptions, and tips on how to hide your program files?: 
     <br />
       <input name='securityFeatures' type='radio' value='Yes'/>Yes
     <br />
       <input name='securityFeatures' type='radio' value='No'/>No
     <br /><br />
  5. Would twenty dollars be more than you are willing to pay for a well-designed Book of Shadows program? If so, how much 
     would meet your budget requirements?
      <br />
    <input name='moneyAmount' type='text' />
      <br /><br />
  6. Would you like a user-friendly cataloging system for your Magick/Pagan books?
     <br />
       <input name='catalogingSystem' type='radio' value='Yes'/>Yes
     <br />
       <input name='catalogingSystem' type='radio' value='No'/>No
     <br /><br />      
  
 
 
<input type='submit' />
  </form>";
  }
?>
 
</body>
</html>
 
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: PHP Mail Function

Post by alex.barylski »

Use SwiftMailer...mail() sucks for anything but the most trivial mail...

Find the forum on here at the bottom of the list...download the code and when you have issues you can ask Chris directly and get answers much faster. Signup for a GMail account and use their SMTP server for testing purposes then rent one from smtp.com or auth-smtp.com when you requirements grow beyond what GMail offers.

Way more flexible and far more scalable. Again, mail() sucks. :P
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: PHP Mail Function

Post by DenKain »

Hockey wrote:Use SwiftMailer...mail() sucks for anything but the most trivial mail...

Find the forum on here at the bottom of the list...download the code and when you have issues you can ask Chris directly and get answers much faster. Signup for a GMail account and use their SMTP server for testing purposes then rent one from smtp.com or auth-smtp.com when you requirements grow beyond what GMail offers.

Way more flexible and far more scalable. Again, mail() sucks. :P
Would I not have to have access to my server's PHP folder to add this? If so I am renting my server space from GoDaddy.com.
alex.barylski
DevNet Evangelist
Posts: 6267
Joined: Tue Dec 21, 2004 5:00 pm
Location: Winnipeg

Re: PHP Mail Function

Post by alex.barylski »

Your servers PHP folder? To change the INI file? No.

I think SwiftMailer uses sockets directly, which I think are included by default. You would need to be able to upload SwiftMailer to your directory though and include it, but if you hosting PHP code you can likely do this. Otherwise I'm not sure how you would go abouts having a PHP powered web site.
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: PHP Mail Function

Post by DenKain »

I would still like to know what I did wrong.
DenKain
Forum Newbie
Posts: 8
Joined: Mon Jul 14, 2008 7:37 pm

Re: PHP Mail Function

Post by DenKain »

I fixed it, my IF Statement was using a variable that I had renamed so it kept coming up false and reloading the page.
Post Reply