Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 509345
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T07:00:05+00:00 2026-05-13T07:00:05+00:00

<?php //define the receiver of the email $to = ‘pradz39@gmail.com’; //define the subject of

  • 0
<?php
//define the receiver of the email
$to = 'pradz39@gmail.com';
//define the subject of the email
$subject = 'Test email';
//define the message to be sent. Each line should be separated with \n
$message = "Hello";
//define the headers we want passed. Note that they are separated with \r\n
$headers = "From: webmaster@example.com\r\nReply-To: webmaster@example.com";
//send the email
$mail_sent = mail( $to, $subject, $message, $headers );
//if the message is sent successfully print "Mail sent". Otherwise print "Mail failed" 
echo $mail_sent ? "Mail sent" : "Mail failed";
?>

i am using xampp for windows can you help me to configure smtp server…..

output is

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 D:\installed\xampp\htdocs\mail.php on line 13
Mail failed

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T07:00:05+00:00Added an answer on May 13, 2026 at 7:00 am

    PHP mail() needs a mail relay server to actually send mail. On hosting providers, the enviroment is preconfigured and ready for use.

    These are the possible solutions for you.

    • In your case you must check if your xampp bundle comes with a mail server and setup/start it
    • If it doesn’t come with a mail server, then you need to either setup your IIS SMTP server instructions at http://support.microsoft.com/kb/230235
    • Or download and install a free smpt server like Argosoft
    • You can also use a php package that can directly connect to SMTP with authentication support and use your real smpt server (hotmail, yahoo etc, isp) for relaying. This can be done with PHPMailer and it worked for me too.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using the following code to send e-mails from php. $to = 'myemail@domain.com'; $subject
Please consider the following URLs: http://www.mydomain.com/a/test.php https://www.mydomain.org/a/b/test.php http://www.mydomain.co.nr/a/b/c/test.php https://www.mydomain.com/a/b/c/d/test.php http://www.mydomain.co.uk/a/b/c/d/e/test.php https://www.mydomain.co.au.nm/a/b/c/d/e/f/test.php?var1=test1&var2=test2 Now I want
login.php <?php define('client_id', 'cid'); define('redirect_uri', 'http://domain.tld/file.php'); define('client_secret', 'secret'); $endpoint = 'https://accounts.google.com/o/oauth2/auth'; $querystr = array(
it's all in index.php /* Define site root */ defined('DOCUMENT_ROOT') ? null : define('DOCUMENT_ROOT',realpath(dirname(__FILE__)));
C++ preprocessor #define is totally different. Is the PHP define() any different than just
i have the following piece of code in php: define('QUERY', $some_query_string); if(empty(QUERY) || mb_strlen(QUERY)
Consider: <?php define('my_const', 100); echo <<<MYECHO <p>The value of my_const is {my_const}.</p> MYECHO; ?>
My code is like this: <?php define(ERROR, SOMETHING WRONG WITH MY DATABASE); ... if
consider the following code scenario: <?php //widgetfactory.class.php // define a class class WidgetFactory {
I'm trying to manipulate the output of Wordpress' the_date() function. My code: <?php define('WP_USE_THEMES',

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.