Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Unable to send mail ***caution Newbie**

3 views
Skip to first unread message

balda...@yahoo.com

unread,
Aug 18, 2008, 12:16:51 AM8/18/08
to
hi I am using Xamp ,
(1) When i use this script

<?php

$check = checkdnsrr("yahoo.com", "ANY" );
if( $check)
{
print "Not available";
}
else
{
print "Available";
}

?>

I get an error message "Fatal error: Call to undefined function
checkdnsrr()"

is it that This function has been restricted on Xampp or am i doing
something wrong?

(2) Now i was trying to send a mail with Following Code


<?php
$headres ="From:My mail address\n";
$headers.="MIME-Version: 1.0\n";
$headers.="Content-type: text/plain;charset=ISO-8859-1\n";
if(Mail("to mail address i need to send ","Test Mail","Hello World",
$headres))
{print "Mail Successfully Send";
}
else
{
Print "Mail Not Send ";
}
?>

I have initialized Php ini file with Smtp address , Port.

Stopped and Started Php again and also booted my laptop again.

I get a warning

Warning: mail() [function.mail]: SMTP server response: 550 relaying
denied in F:\Softwares\Xampp\htdocs\sendmail2.php on line 5
Mail Not Send

After doing this i realized Sending mail with yahoo or gmail requires
me to send mail via smtp autentication and SSL
Now in the below mentioned script there are four mail.php files here ,

which one to use ? i have used mail.php file in PEAR as i am sending
mail using PEAR ,

But its not working.

<?php
require_once "..\php\PEAR\Mail.php";

$from = "<my mail address>";
$to = "<to whom ever i want to send mail>";
$subject = "Hi!";
$body = "Hi,\n\nHow are you?";

$host = "smtp.gmail.com";
$port = "465";
$username = "my user "name @gmail.com";
$password = "my password";

$headers = array ('From' => $from,
'To' => $to,
'Subject' => $subject);
$smtp = Mail::factory('smtp',
array ('host' => $host,
'port' => $port,
'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>");
}
?>


Though this script run's with out error but the page takes some to
load and then no messages are shown.
I dont understand what am i doing wrong.

if possible Let me know what am i doing wrong , and plese send me some
references or what to search for ?

Thank's in advance
baldaris

Jensen Somers

unread,
Aug 18, 2008, 4:38:43 AM8/18/08
to
Hello,

balda...@yahoo.com wrote:
> hi I am using Xamp ,
> (1) When i use this script
>
> <?php
>
> $check = checkdnsrr("yahoo.com", "ANY" );
> if( $check)
> {
> print "Not available";
> }
> else
> {
> print "Available";
> }
>
> ?>
>
> I get an error message "Fatal error: Call to undefined function
> checkdnsrr()"
>
> is it that This function has been restricted on Xampp or am i doing
> something wrong?

According to the documentation at http://be.php.net/checkdnsrr this
function is not implemented on Windows platforms. Try the PEAR class
Net_DNS.

Sorry, can't really help with those. The only SMTP mail class I ever
used was the PHPMailer class from Codeworx
(http://phpmailer.codeworxtech.com/) which worked pretty well for me
since I did not have PEAR support at my web server back than.

> Thank's in advance
> baldaris

- Jensen

--
Jensen Somers <http://jsomers.eu>
Email: -http:// +jensen@

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying to
produce bigger and better idiots. So far, the Universe is winning."
- Rick Cook, The Wizardry Compiled

Bleak

unread,
Aug 18, 2008, 9:23:12 AM8/18/08
to

in the code you posted you set both $headres and $headers (mess).

balda...@yahoo.com

unread,
Aug 18, 2008, 10:39:28 AM8/18/08
to
On Aug 18, 6:23 pm, Bleak <manico...@gmail.com> wrote:
> On Aug 18, 6:16 am, baldari...@yahoo.com wrote:
>
>
>
> > hi I am using Xamp ,
> > (1) When i use this script
>
> > <?php
>
> > $check = checkdnsrr("yahoo.com", "ANY" );
> > if( $check)
> > {
> > print "Not available";}
>
> > else
> > {
> > print "Available";
>
> > }
>
> > ?>
>
> > I get an error message "Fatal error: Call to undefined function
> > checkdnsrr()"
>
> > is it that This function has been restricted on Xampp or am i doing
> > something wrong?
>
> > (2) Now i was trying tosendamailwith Following Code
>
> > <?php
> > $headres ="From:Mymailaddress\n";

> > $headers.="MIME-Version: 1.0\n";
> > $headers.="Content-type: text/plain;charset=ISO-8859-1\n";
> > if(Mail("tomailaddress i need tosend","TestMail","Hello World",

> > $headres))
> > {print "MailSuccessfullySend";}
>
> > else
> > {
> > Print "MailNotSend";}
>
> > ?>
>
> > I have initializedPhpini file with Smtp address , Port.
>
> > Stopped and StartedPhpagain and also booted my laptop again.

>
> > I get a warning
>
> > Warning:mail() [function.mail]: SMTP server response: 550 relaying
> > denied in F:\Softwares\Xampp\htdocs\sendmail2.phpon line 5
> >MailNotSend
>
> > After doing this i realized Sendingmailwith yahoo or gmail requires
> > me tosendmailvia smtp autentication and SSL
> > Now in the below mentioned script there are fourmail.phpfiles here ,
>
> > which one to use ? i have used mail.phpfile in PEAR as i am sending
> >mailusing PEAR ,

>
> > But its not working.
>
> > <?php
> > require_once "..\php\PEAR\Mail.php";
>
> > $from = "<mymailaddress>";
> > $to = "<to whom ever i want tosendmail>";
> > $subject = "Hi!";
> > $body = "Hi,\n\nHow are you?";
>
> > $host = "smtp.gmail.com";
> > $port = "465";
> > $username = "my user "name @gmail.com";
> > $password = "my password";
>
> > $headers = array ('From' => $from,
> > 'To' => $to,
> > 'Subject' => $subject);
> > $smtp =Mail::factory('smtp',

> > array ('host' => $host,
> > 'port' => $port,
> > '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>");
> > }
> > ?>
>
> > Though this script run's with out error but the page takes some to
> > load and then no messages are shown.
> > I dont understand what am i doing wrong.
>
> > if possible Let me know what am i doing wrong , and plesesendme some

> > references or what to search for ?
>
> > Thank's in advance
> >baldaris
>
> in the code you posted you set both $headres and $headers (mess).

Thank's for replying....Its actually a spelling mistage while writing.

balda...@yahoo.com

unread,
Aug 18, 2008, 10:41:09 AM8/18/08
to
On Aug 18, 6:23 pm, Bleak <manico...@gmail.com> wrote:
> On Aug 18, 6:16 am, baldari...@yahoo.com wrote:
>
>
>
> > hi I am using Xamp ,
> > (1) When i use this script
>
> > <?php
>
> > $check = checkdnsrr("yahoo.com", "ANY" );
> > if( $check)
> > {
> > print "Not available";}
>
> > else
> > {
> > print "Available";
>
> > }
>
> > ?>
>
> > I get an error message "Fatal error: Call to undefined function
> > checkdnsrr()"
>
> > is it that This function has been restricted on Xampp or am i doing
> > something wrong?
>
> > (2) Now i was trying tosendamailwith Following Code
>
> > <?php
> > $headres ="From:Mymailaddress\n";

> > $headers.="MIME-Version: 1.0\n";
> > $headers.="Content-type: text/plain;charset=ISO-8859-1\n";
> > if(Mail("tomailaddress i need tosend","TestMail","Hello World",
> > $headres))

> > {print "MailSuccessfullySend";}
>
> > else
> > {
> > Print "MailNotSend";}
>
> > ?>
>
> > I have initializedPhpini file with Smtp address , Port.
>
> > Stopped and StartedPhpagain and also booted my laptop again.

>
> > I get a warning
>
> > Warning:mail() [function.mail]: SMTP server response: 550 relaying
> > denied in F:\Softwares\Xampp\htdocs\sendmail2.phpon line 5
> >MailNotSend
>
> > After doing this i realized Sendingmailwith yahoo or gmail requires
> > me tosendmailvia smtp autentication and SSL
> > Now in the below mentioned script there are fourmail.phpfiles here ,
>
> > which one to use ? i have used mail.phpfile in PEAR as i am sending
> >mailusing PEAR ,

>
> > But its not working.
>
> > <?php
> > require_once "..\php\PEAR\Mail.php";
>
> > $from = "<mymailaddress>";
> > $to = "<to whom ever i want tosendmail>";
> > $subject = "Hi!";
> > $body = "Hi,\n\nHow are you?";
>
> > $host = "smtp.gmail.com";
> > $port = "465";
> > $username = "my user "name @gmail.com";
> > $password = "my password";
>
> > $headers = array ('From' => $from,
> > 'To' => $to,
> > 'Subject' => $subject);
> > $smtp =Mail::factory('smtp',

> > array ('host' => $host,
> > 'port' => $port,
> > '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>");
> > }
> > ?>
>
> > Though this script run's with out error but the page takes some to
> > load and then no messages are shown.
> > I dont understand what am i doing wrong.
>
> > if possible Let me know what am i doing wrong , and plesesendme some

> > references or what to search for ?
>
> > Thank's in advance
> >baldaris
>
> in the code you posted you set both $headres and $headers (mess).

Can you suggest me some Smtp server's and port by which i can send
mail's?
Thank's in advance

Jerry Stuckle

unread,
Aug 18, 2008, 1:35:50 PM8/18/08
to

How about your host's? Or, if you're running this on your home system,
your ISP's?

People don't open their SMTP servers to just anyone - it just makes them
a spam relay.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstu...@attglobal.net
==================

0 new messages