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-
SmtpServer="mail.cbsecsnip.in";
SmtpPort="587";
SmtpUser="support@cbsecsnip.in";
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.

Recommended Answers

All 8 Replies

is this Windows or Linux based server?

Linux

Thank you Squidge for consideration my problem I am using PHP

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

http://php.net

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 PHP.net

--

Example:

<?php
$to      = 'nobody@example.com';
$subject = 'the subject';
$message = 'hello';
$headers = 'From: webmaster@example.com' . "\r\n" .
    'Reply-To: webmaster@example.com' . "\r\n" .
    'X-Mailer: PHP/' . phpversion();

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

OK let me try your code

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

<?php

    $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

Squidge

@ vishalonne

not a problem, glad it is resolved :)

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.