Jump to content


Photo

mail() function!


  • Please log in to reply
4 replies to this topic

#1 ShaKeD

ShaKeD
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 15 September 2006 - 02:30 PM

Hey again,

I was trying to use mail(); function and I got no luck, why is that?

mail($user,$subject."(from)",$message,"From $user");
$user= my email ..
$subject = subject from edit box
$message= from edit box... 

what do you think?


#2 obsidian

obsidian
  • Staff Alumni
  • Advanced Member
  • 3,202 posts
  • LocationSeattle, WA

Posted 15 September 2006 - 02:36 PM

youre header is not assigned properly. if you're using the "From" header, you need to have a colon following the "From":
<?php
mail($user, $subject . "(from)", $message, "From: $user");
?>

You can't win, you can't lose, you can't break even... you can't even get out of the game.

<?php
while (count($life->getQuestions()) > 0)
{   $life->study(); } ?>
  LINKS: PHP: Manual MySQL: Manual PostgreSQL: Manual (X)HTML: Validate It! CSS: A List Apart | IE bug fixes | Zen Garden | Validate It! JavaScript: Reference Cards RegEx: Everything RegEx

#3 ShaKeD

ShaKeD
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 15 September 2006 - 02:44 PM

I didn't understand the differenet.. .

this is my code.. :
  <?php
.
.
.
 $headers = "From: <email>\r\nReply-To: email";
  mail($user,$subject,$message,$headers);
.
.
.
?>


#4 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 15 September 2006 - 03:03 PM

this is my code ...


And that's different from what you posted to start this thread.  Instead of posting one or two lines of code, post anything that relates to the construction of headers and variables that end up in the mail() function.
Legend has it that reading the manual never killed anyone.
My site

#5 ShaKeD

ShaKeD
  • Members
  • PipPip
  • Member
  • 23 posts

Posted 15 September 2006 - 04:15 PM

ok so I`m using mbot plugin for miranda, this plugin give you to bulid things with php and use them on the miranda, so I have start to work on script that sends emaill throw miranda..
so I did this function :
function dlg_callback($ok,$param)
{
  if($ok == 0)return 1; //cancel or close

  $dlg = mb_DlgGet();
  $user =  mb_DlgGetText($dlg,1000);
  $subject = mb_DlgGetText($dlg,1002);
  $message = mb_DlgGetText($dlg,1004);
  $headers = "From: <email>\r\nReply-To: email";
  if($subject != "" && $message != ""){
    mail($user,$subject,$message,$headers);
    mb_msgbox("your message has been sent to ".$user);
    return 1;
  }else{
    mbox("you must use the subject and message body both.");
    return 0; //if you want to finish the dialog return "end";
  }
}

I checked if I get somthing in $message,$subject and $user and I did, I got everything I need
for ex. :
$user = myemail@gmail.com
$subject = hey whats up!
$message = this is a test

the problem the I don't get any mail at all..

what can I do ?

10x :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users