1,105,225 Community Members

How to send mail using PHP from SMTP

Member Avatar
vishalonne
Posting Whiz in Training
227 posts since Jun 2009
Reputation Points: 12 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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.

Member Avatar
Squidge
Posting Pro in Training
476 posts since Dec 2009
Reputation Points: 101 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 6 [?]
 
0
 

is this Windows or Linux based server?

Member Avatar
vishalonne
Posting Whiz in Training
227 posts since Jun 2009
Reputation Points: 12 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Linux

Member Avatar
vishalonne
Posting Whiz in Training
227 posts since Jun 2009
Reputation Points: 12 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

Thank you Squidge for consideration my problem I am using PHP

Member Avatar
Squidge
Posting Pro in Training
476 posts since Dec 2009
Reputation Points: 101 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 6 [?]
 
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);
?>
Member Avatar
vishalonne
Posting Whiz in Training
227 posts since Jun 2009
Reputation Points: 12 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

OK let me try your code

Member Avatar
Squidge
Posting Pro in Training
476 posts since Dec 2009
Reputation Points: 101 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 6 [?]
 
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

?>
Member Avatar
vishalonne
Posting Whiz in Training
227 posts since Jun 2009
Reputation Points: 12 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
 
0
 

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

Question Answered as of 1 Year Ago by Squidge
Member Avatar
Squidge
Posting Pro in Training
476 posts since Dec 2009
Reputation Points: 101 [?]
Q&As Helped to Solve: 75 [?]
Skill Endorsements: 6 [?]
 
0
 

@ vishalonne

not a problem, glad it is resolved :)

huan.azevedo
Newbie Poster
1 post since Dec 2012
Reputation Points: 0 [?]
Q&As Helped to Solve: 0 [?]
Skill Endorsements: 0 [?]
Unverified Member
 
0
 

jhhjjj
jjkjhkjhkh

jkjhhkhhk

You
This question has already been solved: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article