I have been trying to send email for 2 days. using php I have tried different methods but to no avail .
I am sure I am making some small mistake.
Please can someone give step by step procedure of sending mail using Xampp?

What have you tried that is not working ?

http://expertester.wordpress.com/2010/07/07/how-to-send-email-from-xampp-php/

I followed all the steps .Here is my php

<?php


//email(to,subject,message,headers,parameters)
$to="<swissknife007@gmail.com>";
$subject="Hi";
$message="Hello my friend";
$from="swissknife007@gmail.com";

$headers = "From: sender@sender.com" ;
mail($to,$subject,$message,$headers);
echo" mail sent";

?>

The error I am getting is

Warning: mail() [function.mail]: SMTP server response: 530-5.5.1 Authentication Required. Learn more at 530 5.5.1 http://mail.google.com/support/bin/answer.py?answer=14257 wp7sm14504615igc.6 in F:\xampp\htdocs\email1.php on line 11
mail sent


Please help now.

Your password is set correctly in the ini file ?

Your password is set correctly in the ini file ?

yes
I in the sendmail.ini it is set correctly
can u repeat the php.ini settings for me as i have changed them quite a lot now only for send mail function.

It's in the link in the previous post.

yes
I in the sendmail.ini it is set correctly
can u repeat the php.ini settings for me as i have changed them quite a lot now only for send mail function.

somebody help please

yes it doesn't have all the send mail setings though

[mail function]
; For Win32 only.
; http://php.net/smtp
;SMTP = smtp.gmail.com
; http://php.net/smtp-port
;smtp_port = 587;

; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = swissknife007@gmail.com

; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = “\”F:\xampp\sendmail\sendmail.exe\” -t”

; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "F:\xampp\php\logs\php_mail.log"

are my settings correct?

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("someone@example.com", "$subject",
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

And in your php.ini make sure you have these set correctly
[mail function]
SMTP = "my.mailserver.dom" //localhost, gmail, yahoo..
smtp_port = 25
smtp_username = "" <-- If mail server requires a username
smtp_password = "" <-- If mail server requires a password

//Change values
//PHP_INI_ALL
sendmail_from NULL
//PHP_INI_SYSTEM
sendmail_path "/usr/sbin/sendmail -t -i"

Hope this helps

<html>
<body>

<?php
if (isset($_REQUEST['email']))
//if "email" is filled out, send email
  {
  //send email
  $email = $_REQUEST['email'] ;
  $subject = $_REQUEST['subject'] ;
  $message = $_REQUEST['message'] ;
  mail("someone@example.com", "$subject",
  $message, "From:" . $email);
  echo "Thank you for using our mail form";
  }
else
//if "email" is not filled out, display the form
  {
  echo "<form method='post' action='mailform.php'>
  Email: <input name='email' type='text' /><br />
  Subject: <input name='subject' type='text' /><br />
  Message:<br />
  <textarea name='message' rows='15' cols='40'>
  </textarea><br />
  <input type='submit' />
  </form>";
  }
?>

</body>
</html>

And in your php.ini make sure you have these set correctly
[mail function]
SMTP = "my.mailserver.dom" //localhost, gmail, yahoo..
smtp_port = 25
smtp_username = "" <-- If mail server requires a username
smtp_password = "" <-- If mail server requires a password

//Change values
//PHP_INI_ALL
sendmail_from NULL
//PHP_INI_SYSTEM
sendmail_path "/usr/sbin/sendmail -t -i"

Hope this helps

i am getting this error now
Warning: mail() [function.mail]: Mailserver rejected our "sendmail_from" setting in F:\xampp\htdocs\email1.php on line 11
mail sent

Does ; before any statement in php.ini denote a comment?

Correct, ; starts a comment.

Correct, ; starts a comment.

i had posted my php.ini settings are they correct

i had posted my php.ini settings are they correct

[mail function]
; For Win32 only.
; http://php.net/smtp
SMTP = smtp.gmail.com
; http://php.net/smtp-port

;smtp_port = 587;
;smtp_username = "swissknife007"
;smtp_password = *************
; For Win32 only.
; http://php.net/sendmail-from
;sendmail_from = ""
sendmail_path = “F:\xampp\sendmail\sendmail.exe -t”
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; http://php.net/sendmail-path
sendmail_path = “\”F:\xampp\sendmail\sendmail.exe\” -t”
; Force the addition of the specified parameters to be passed as extra parameters
; to the sendmail binary. These parameters will always replace the value of
; the 5th parameter to mail(), even in safe mode.
;mail.force_extra_parameters =

; Add X-PHP-Originating-Script: that will include uid of the script followed by the filename
mail.add_x_header = Off

; Log all mail() calls including the full path of the script, line #, to address and headers
;mail.log = "F:\xampp\php\logs\php_mail.log"


No help yet.Do I require phpmailer class?

Make sure you change
sendmail_from NULL
to
sendmail_from "blah@something.com"

No help yet. Do I require phpmailer class?

Using PHPMailer would've saved you all this hassle.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.