I want to test the mail() function in my scripts(noob) where I can send and receive e-mail using the same localmachine without having to connect to the internet. What do I need to do this?

    Assuming you're using Linux, just configure exim or something with some ficticious mail delivery domain as its own domain, and have it deliver to local users.

    So if you created a local user called fred, you can have it think its domain is fake.private, then you can mail fred@fake.private and it should arrive.

    Mark

      what if you are on a windows box? it's obviausly local.

      fred@localhost? or fred@localhost.com?

      second should be completly wrong but i'm aware of things working 'oddly' at times

        Find this in your php.ini;

        [mail function]
        ; For Win32 only. //Remove any semicolons if there on next line
        SMTP = mail.bna.bellsouth.net//This is mine put yours in here
        smtp_port = 25
        
        ; For Win32 only.//Remove an semicolons if there on next line
        sendmail_from = youremail@somewhere.com //put your email address here (done)
        
        ; For Unix only.  You may supply arguments as well (default: "sendmail -t -i").
        ;sendmail_path = "C:\Program Files\xampp\sendmail\sendmail.exe -t"

          hmmmm, i did this in xampp (i see you have that too e-giggle) in the php.ini. this is the INI's code:

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

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

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

          this is on a windows box so it doesn't matter that i put in the UNIX stuff.

          secondly this is my mail.php:

          <?php 
              $to      = 'myemail@yahoo.com'; 
              $subject = 'the subject'; 
              $message = 'hello'; 
              $headers = 'From: [email]webmaster@example.com[/email]' . "\r\n" . 
                 'Reply-To: [email]webmaster@example.com[/email]' . "\r\n" . 
                 'X-Mailer: PHP/' . phpversion(); 
              //ini_set("SMTP","smtp.yoursite.com"); 
              mail($to, $subject, $message, $headers); 
          ?>
          

          and this is the error that i keep getting:

          error wrote:

          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:\Program Files\Developer\apachefriends\xampp\htdocs\member\mail.php on line 9

            The php.ini that you must updat using XAMPP is in the apache/bin folder, plus you have to restart your server, right now it hasn't seen the change, the error is showing the default of localhost not you email, and I would edit that email in your post if not for mail or spam bots but for other users also, they do crawl forums and look for email addys.

              ok that helped alot thanx.

              i still can't send email because i don't have an SMTP folder. i restarted and redid the changes and used a few. i just can't send the mail.

              honestly i just wanted to test locally for that feature for my user authentication but it seems that i can't do it locally without a good SMTP server. i'll just ass in PHP Mailer later and test it locally and remotely.

              thank you for your help. you helped alot actually, it's been a pleasure.

                Use the setting that you use for your normal Outlook Express , Outlook, or Thunderbird to send and recieve email and it will work, I use mine all the time, it is just the email that came with my ISP account.

                  I am using easyphp as a test server on Windows XP, and it has these settings in php.ini

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

                  I know I need an SMTP server, but I don't have one. I want to check if the mail() function in the php scripts I am using really sends e-mails such as confirmation mails. I want to do this locally without having to connect to the internet. What programs do I need?

                    All you need to have is the mailserver that is used your ISP. Don't you have email from your service provider? If you use Windows then you have Outlook Express possibly Outlook if you have Office. Just use the account info that you use for your local machines email client like SMTP = localhost would then instead be SMTP = mail.yourisp.com and sendmail_from = youremailaddress@yourisp.com

                      Houdini wrote:

                      All you need to have is the mailserver that is used your ISP. Don't you have email from your service provider? If you use Windows then you have Outlook Express possibly Outlook if you have Office. Just use the account info that you use for your local machines email client like SMTP = localhost would then instead be SMTP = mail.yourisp.com and sendmail_from = youremailaddress@yourisp.com

                      I don't have an smtp server. What I want is if I can test the mail() function in a single computer that is not connected to the internet. It's like mailing myself in the same machine(sounds weird). Actually I need it so I can show that the php scripts (shopping carts) really send confirmation mails. I will be using it for a software demonstration in my thesis

                        Download and install Mercury Mail it is a free emailserver and also has an email client that you can download also. That program is called Pegasus, just do a google search for Mercury Mail and you can then test locally, it does take some frustation to try setting it up but it does work but I haven't used it in years.

                          Write a Reply...