SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    help needed...how to send mail using php mail function?

    hello everyone,just want to ask how could i use the send mail function of php...im using XAMPP web server and i don't know how to configure it,can anyone tell me how to do it, what i want to do is make my own send mail form using HTML and then just send it, id really appreciate it if someone help.tnx...

  2. #2
    SitePoint Guru
    Join Date
    Jul 2005
    Location
    Orlando
    Posts
    634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    From your comments it doesn't sound like you've tried.

    http://php.net/mail

    Try that link. If you have problems, please come back and list them specifically.

  3. #3
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Set up an SMTP server in php.ini and you should be able to use it.

  4. #4
    SitePoint Enthusiast
    Join Date
    Nov 2007
    Posts
    64
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hello again, i tried using this php codes on testmail.php

    PHP Code:
    <?php

    $to 
    "lm_nicolas26@yahoo.com.ph";
    $subject "Test mail";
    $message "Hello! This is a simple email message.";
    $from "sakuragi_26_chill@yahoo.com";
    $headers "From: $from";
    mail($to,$subject,$message,$headers);
    echo 
    "Mail Sent.";

    ?>
    its an error:
    Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\xampp\htdocs\testmail.php on line 8
    Mail Sent.



    here is the php.ini config:

    [mail function]
    ; For Win32 only.
    SMTP = localhost
    smtp_port = 25

    ; For Win32 only.
    sendmail_from = sakuragi_26_chill@yahoo.com

    ; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
    ;sendmail_path = "C:\xampp\sendmail\sendmail.exe -t"


    can anyone tell me how to fix this?tnx...

  5. #5
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    As I said, you need to set up the SMTP server in php.ini. Unless you are running an SMTP server on your local machine, 'localhost' won't work.

  6. #6
    SitePoint Addict scoobasteve1982's Avatar
    Join Date
    Apr 2007
    Posts
    333
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Set the local host to the IP of the mail server (i.e. 168.1.213.44)...that is, where ever the IP address of the mail server is....

  7. #7
    SitePoint Wizard bronze trophy Kailash Badu's Avatar
    Join Date
    Nov 2005
    Posts
    2,560
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you don't have a SMPT in your local server (localhost), try using the code in a live server of your host.


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
  •