Start New Discussion within our Web Development Community

Dear All

How can I send mail from my site using SMTP outgoing mail server. I tried and checked may way but not achive any positive result.

Here is my mail server detail-
SmtpPass="password@123"; // assume this is the password

Can any body help me out in this with some sort of code.

I am trying one example I found on net -Example Site But this also not works.

Thank you in advance.

Sorry i miss read. you would use the "mail" function:

That should help.


I hadnt seen the link you posted.

I have never had to do this that way.

The SMTP would be configured by your hosting, so just use the "mail" function from my link to



$to      = '';
$subject = 'the subject';
$message = 'hello';
$headers = 'From:' . "\r\n" .
    'Reply-To:' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

mail($to, $subject, $message, $headers);

Thatis an example from - this is not from me.t


    $to = '' // email address where to send
    $subject = '' // Subject matter captured from form
    $message = '' // captured from form

    mail($to, $subject, $message); // Sends the message


Thank you Squidge really a silly mistake gives lots of pain I was not passing the value of email from form page. Any ways thankyou for extended support.
Thank you very much


This question has already been answered. Start a new discussion instead.