Current location: Hot Scripts Forums » Programming Languages » PHP » Help with php mail function


Help with php mail function

Reply
  #1 (permalink)  
Old 08-03-06, 02:47 PM
maverickminds maverickminds is offline
New Member
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Help with php mail function

hello,
I am relatively new to the php.. I need help with the php mail function. The mail function does not works on my home laptop.. I write the following code.

PHP Code:

$fname = "Maverick";           // Name to be shown in from details.

$femail = "maverickminds@gmail.com";  // E-mail address to be shown in  from details.

if(!isset($action)){

?>


<form name="form1" method="post" action="mailform.php">
<input name="action" type="hidden" value="send">
<table width="370" border="0" cellspacing="0" cellpadding="2">
  <tr>
    <td width="120" >to e-mail:</td>
    <td width="250" ><input name="toemail" type="text" size="30"></td>
  </tr>

  <tr>
    <td>subject:</td>
    <td><input name="subject" type="text" size="30" value=""></td>
  </tr>
  <tr>
    <td  valign="top">message:</td>
    <td>
     <textarea name="message" rows="5" cols="35">

     </textarea>
    </td>
  </tr>
  <tr>
    <td>type:</td>
    <td>
      text&nbsp;<input name="rdType" type="radio" value="0" checked>
      &nbsp;&nbsp;
      html&nbsp;<input name="rdType" type="radio" value="1">
    </td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>
     <input name="cmdSend" type="submit" value="send">&nbsp;
     <input name="cmdReset" type="reset" value="reset">
    </td>
  </tr>
</table>
</form>


<?php
}else{
 
$from $fname "<$femail>";
 
$headers "From: $from \r\n";
 if(
$rdType == 1){
   
$headers .= "MIME-Version: 1.0\n" "Content-type: text/html; charset=iso-8859-1";
   
$message stripslashes($message);
 }else{
   
$headers .= "MIME-Version: 1.0\n" "Content-type: text/plain; charset=iso-8859-1";
 }
 
$ok = @mail($toemail$subject$message$headers);
  if (
$ok) {
   echo 
"<center><font class='general'>Mail sent successfully. Thank you.</font></center>";
  } else {
   echo 
"<center><font class='general'>Mail could not be sent.</font></center>";
  }
 }

?>
I guess that we need to point the php to our mail sending program such as outlook. i dont have any mail sending program on my laptop.. can't i use this function or there is some work around. i want SMTP only.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 08-03-06, 06:33 PM
duesi's Avatar
duesi duesi is offline
Wannabe Coder
 
Join Date: Jun 2006
Posts: 225
Thanks: 0
Thanked 0 Times in 0 Posts
I recommend you to use phpmailer

http://phpmailer.sourceforge.net/

I find it easier to use than PHPs mail function.

Happy Coding!
__________________
Duesi

"One of the great skills in using any language is knowing what not to use, what not to say" (Ron Jeffries)

http://www.swissbytes.de
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 08-04-06, 12:51 AM
mab's Avatar
mab mab is offline
Community VIP
 
Join Date: Oct 2005
Location: Denver, Co. USA
Posts: 2,674
Thanks: 0
Thanked 0 Times in 0 Posts
I recommend phpmailer as well, since in this case you would need to connect to a SMTP mail server and provide logon authentication against a mail box account on that server. The PHP mail function cannot handle SMTP authentication.
__________________
Error checking, error reporting, and error recovery. If your code does not have these to get it to tell you why it is not working, what makes you think someone in a programming forum will be able to tell you why it is not working???
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
PHP mail function with AOL IDs on Linux jeephp PHP 2 04-24-06 09:26 AM
PHP mail function and Gmail strings6 PHP 8 12-29-05 08:58 AM
PHP mail function and sending php content. strings6 PHP 4 12-27-05 09:03 AM
ASP upload prob minority ASP 1 06-27-05 09:35 AM
PHP Error Fairnie PHP 8 06-26-04 08:15 AM


All times are GMT -5. The time now is 10:19 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.