We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,752 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

How to send mail using PHP from SMTP

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.

3
Contributors
9
Replies
3 Months
Discussion Span
5 Months Ago
Last Updated
11
Views
Question
Answered
vishalonne
Junior Poster
185 posts since Jun 2009
Reputation Points: 22
Solved Threads: 0
Skill Endorsements: 0

is this Windows or Linux based server?

Squidge
Posting Pro in Training
410 posts since Dec 2009
Reputation Points: 111
Solved Threads: 60
Skill Endorsements: 5

Linux

vishalonne
Junior Poster
185 posts since Jun 2009
Reputation Points: 22
Solved Threads: 0
Skill Endorsements: 0

Thank you Squidge for consideration my problem I am using PHP

vishalonne
Junior Poster
185 posts since Jun 2009
Reputation Points: 22
Solved Threads: 0
Skill Endorsements: 0

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);
?>
Squidge
Posting Pro in Training
410 posts since Dec 2009
Reputation Points: 111
Solved Threads: 60
Skill Endorsements: 5

OK let me try your code

vishalonne
Junior Poster
185 posts since Jun 2009
Reputation Points: 22
Solved Threads: 0
Skill Endorsements: 0

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

?>
Squidge
Posting Pro in Training
410 posts since Dec 2009
Reputation Points: 111
Solved Threads: 60
Skill Endorsements: 5

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
Junior Poster
185 posts since Jun 2009
Reputation Points: 22
Solved Threads: 0
Skill Endorsements: 0
Question Answered as of 9 Months Ago by Squidge

@ vishalonne

not a problem, glad it is resolved :)

Squidge
Posting Pro in Training
410 posts since Dec 2009
Reputation Points: 111
Solved Threads: 60
Skill Endorsements: 5

jhhjjj
jjkjhkjhkh

jkjhhkhhk

huan.azevedo
Newbie Poster
1 post since Dec 2012
Reputation Points: 0
Solved Threads: 0
Skill Endorsements: 0

This question has already been solved: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.0934 seconds using 2.7MB