We help IT Professionals succeed at work.
Get Started

change to server configuration to make this code work

rgb192
rgb192 asked
on
638 Views
Last Modified: 2012-09-03
I am using wamp on my desktop computer and trying to send mail()  not phpmailer()
i can send my mail list from sendgrid.com using my desktop computer but I can not regularly use phpmailer and gmail because gmail blocks sometimes

so I need to use mail()

do I have to install smtp server or is there something easier to do
to make this code work  (I do not want to change the code)





Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in C:\wamp\www\mail\1.php on line 18

<?php
$subject='subject';
$body='body';
$name='name';
$email='me@gmail.com';
$recipient='me@gmail.com';

$header = "From: ". $name . " <" . $email . ">\r\n";
$header .= "Reply-To: ". $name . " <" . $email . ">\r\n";

$header .= "Return-Path: <".$email.">\n"; 
$header .= "MIME-Version: 1.0\n"; 
$header .= "Content-Type: text/html; charset=ISO-8859-1\n";

$header .= "X-Mailer: PHP/" . phpversion()."\r\n";


mail($recipient, $subject, $body, $header);

?>

Open in new window

Comment
Watch Question
Group MD
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 8 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE