Need help in Mail Functionality

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
murman
Forum Newbie
Posts: 2
Joined: Fri Jan 22, 2010 12:10 am

Need help in Mail Functionality

Post by murman »

Hi,

I am very new to php development. I tried one simple mail program in php

<?php
$to = "ysarunn@gmail.com";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from = "someonelse@example.com";
$headers = "From: $from";
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>


But i am getting error like "SMTP Server Response:454.5.7.3 Client does not have permission to submit to mail server in C:/Wamp/www/mail/mail.php on line 7"

I am trying in my home laptop only.
Pls help me how to work with this mail functionality.
rajeevbharti
Forum Newbie
Posts: 12
Joined: Fri Oct 30, 2009 12:43 am
Location: Delhi

Re: Need help in Mail Functionality

Post by rajeevbharti »

ask the server admin for SMTP user and pass
then send mail using the SMTP method

and then user this code to send the mail

<?php
require_once "Mail.php";

$from = "Sandra Sender <sender@example.com>";
$to = "Ramona Recipient <recipient@example.com>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "mail.example.com";
$username = "smtp_username";
$password = "smtp_password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'auth' => true,
'username' => $username,
'password' => $password));

$mail = $smtp->send($to, $headers, $body);

if (PEAR::isError($mail)) {
echo("<p>" . $mail->getMessage() . "</p>");
} else {
echo("<p>Message successfully sent!</p>");
}
?>
murman
Forum Newbie
Posts: 2
Joined: Fri Jan 22, 2010 12:10 am

Re: Need help in Mail Functionality

Post by murman »

I am trying in my home only. It's not possible to work in home.
If not, Is there any other way to send mail using php programe.
Some frnds are suggesting local mail server. Can anyone help what's that mail server and how to use and can i use in my home laptop.
Post Reply