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

Newbie Mail Question

0 views
Skip to first unread message

Andrew Tucker

unread,
Jul 21, 2003, 12:16:40 AM7/21/03
to
Hi , i want to be able to send an email from a simple php script.
The script is located on a remote server where a site of mine is being
hosted.
Output from the following script says that the mail has been sent
successfully but nothing is showing up in my inbox.
This is what i have tried:

<?php
if(mail("andrew...@optusnet.com.au", "Successful Test", "Successful
mail sent\n")) {
echo "<p> successfully sent mail </p>";
} else {
echo "<p> did not successfully send mail </p>";
}
?>
<html>
<head>
<title> PHP mail Tester Page </title>
</head>
<body> This is a Mail Tester page... </body>
</html>

Any ideas???

cheers, Andrew.


David Robley

unread,
Jul 21, 2003, 8:47:07 PM7/21/03
to
In article <3f1b6927$1...@news.comindico.com.au>,
andrew...@optusnet.com.au says...

> Hi , i want to be able to send an email from a simple php script.
> The script is located on a remote server where a site of mine is being
> hosted.
> Output from the following script says that the mail has been sent
> successfully but nothing is showing up in my inbox.
> This is what i have tried:
>
> <?php
> if(mail("andrew...@optusnet.com.au", "Successful Test", "Successful
> mail sent\n")) {
> echo "<p> successfully sent mail </p>";

Note that this does _NOT_ mean the mail was successfully sent - only that
it was successfully handed off to whatever mail app is specified. For all
php knows, the mail app then chucks it in the bit bucket straight away :-)

> } else {
> echo "<p> did not successfully send mail </p>";
> }
> ?>
> <html>
> <head>
> <title> PHP mail Tester Page </title>
> </head>
> <body> This is a Mail Tester page... </body>
> </html>
>
> Any ideas???

This very topic was discussed in php.general today and the following was
offered as a solution:

--START QUOTE--
When PHP sends an email to a non existing email address such as
Y...@Domain.com, the warning mail you normally get returned often does not
arrive in your mailbox. Therefore I add two additional headers:

."Reply-To: m...@domain.nl\r\n"
."Return-path: <m...@domain.nl\r\n"

and now I do get the notification mail when mail bounces.
--END QUOTE--

Whilst you are probably not having a problem with incorrect addressing,
getting any error message will be more help than just having your message
disappear into /dev/null

For all the discussion, try the php.general archives and search on 'mail
function' in article titles.

Cheers
--
Quod subigo farinam

$email =~ s/oz$/au/o;

0 new messages