Jump to content

Mail()l


webdevdea

Recommended Posts

Im working from this fun PHP sql book while I am out for a few weeks, I am working on an alien abduction form lol its supposed to mail it to me..
here is my code for that part.. can you tell me what I am doing wrong with it?
 

$to = 'webdevdea@gmail.com';
   $subject = 'Aliens Abducted Me - Abduction Report';
   $msg = "$name was abducted $when_it_happened and was gone for $how_long.\n" .
    "Number of aliens: $how_many\n";
    "Alien Description: $alien_description\n";
    "What they did: $what_they_did\n";
    "Fang Spotted: $fang_spotted\n";
    "Other Comments: $other";
     mail($to, $subject, $msg, 'From:' . $email);
Link to comment
Share on other sites

You should tell us what is wrong.

 

Are you getting a php error? No, because I used your script on my localhost and sent the email to myself which works.

 

Have you checked your mail logs for errors?

 

Do you have sendmail configured properly?

Link to comment
Share on other sites

Yeah I didnt look in my junk box, I thought it was not working, I apologize i am new to this just trying to work out some bugs lol .. 

are you running this from your local machine or from a web server. if you are running it from your local machine then you need to make sure your mail client is configured correctly

Link to comment
Share on other sites

Try to send this exampe from php.net:

<?php

$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);
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.