Results 1 to 6 of 6

Thread: Need help in MAIL function

  1. #1
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy Need help in MAIL function

    Hi everybody. This is my first post & I am a PHP newbie.

    Please someone help me here ...

    It is from a form in my site where a user is recommending his friends about my site.
    I want to save the emailIDs in mySql db & then send all of them a html message. Sequentially.
    DB input is okay ... but no email is going.

    What I did:
    Code:
    //The first part is all about inserting in sql db.
    //Total php written in one big <? ... ?>
    
    $to = $eml1 . ", " ; //note the comma
    $to .= $eml2 . ", " ;
    $to .= $eml3 . ", " ;
    $to .= $eml4;
    
    $subject = $usrnm . "has recommended SMILE to you";
    
    $message = ’<html>
    <head><title>smile-india.org.in</title></head>
    <body>
    ...
    ...
    </body>
    </html>’;
    
    $headers = "MIME-Version: 1.0\r\n";
    $headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
    /* additional headers */
    $headers .= "From: <" . $usreml . ">\n";
    
    /* and then mailed it */
    mail($to, $subject, $message, $headers);
    NO EMAIL IS GOING ... WHAT IS WRONG ???
    Should I use 'imap_mail'

    Plz Help

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Some servers have the mail function disabled. Maybe that's the case with your host?

    You could run a page with just:
    <?php phpinfo(); ?>

    and see what comes up.

    That'll tell you all the details of what's going on, and should say if mail is disabled or not.


    Check that first... I also looked at the script, and nothing jumped out as wrong, but that doesn't mean it's neccesarily right. We can check that later.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Dec 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Thanx BUT ...

    While I run the phpinfo() in the server ...
    The following statements about mailing came out ... what THEY mean ???
    [as I told, I am a php newbie]



    That all nothing about php mail function.

    WHAT THEY MEAN ???
    SHOULD I POST THE FULL PHPINFO PAGE ???

    IS IT OK IF I MAKE THE MESSAGE BODY LIKE THIS:
    /* message */
    $body1 = "$v_name just recommended you to visit our site, with this message:\n$v_comm\n\n";
    $body2 = '<html>
    <head><title>smile - symphony for sympathy</title>
    </head>
    <body>
    <table width="515" border="0" cellspacing="0" cellpadding="0">
    ...
    ...
    </table>
    </body></html>';

    $message = $body1 . $body2;
    ..
    ..
    mail($to, $subject, $message, $headers);
    Last edited by ahhiamdying4u; 07-03-2006 at 05:31 AM.

  4. #4
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yeah, that's just fine... it's just simple ways in php to add different parts together.... shouldn't cause any trouble.


    Not sure what that tells us... seems like it implies that mail works... if you could link to the phpinfo page (just a link is fine, no need to paste here), that might help more.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    WELL, DOES THE mail() FUNCTION RETURN TRUE OR FALSE???

    THERE'S NO NEED TO SHOUT, BY THE WAY!!! OVERUSING PUNCTUATION IS A BIT DAFT TOO!!!
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yeah, I guess that's the main question.
    A link would be most helpful.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •