By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,278 Members | 1,358 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,278 IT Pros & Developers. It's quick & easy.

problem when sending mail

P: n/a
Hello

Im trying to send a mail from a php-program. Im using a test program and the
code for this is as follows:

<?php
$from = me@myaddress.com";
$subject = "Test";
$to = 'm**@myaddress.com;
$mailbody = 'mailbody';
mail($to,$subject,$message,$from);
?>

When I run the page/program I get the following error msg displayed:
"Warning: Failed to Connect in G:\home\server\users\me.com\cgi-bin\send.php
on line 5"

The mail is not delivered. I also tried with <> before and after the value
in the $form. And, of course, the addresses are really ones and both are
presents on the server. Does anyone know what the problem could be?

<phpbeginner>
Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"powerboy" <po******@rarextreme.com> wrote in message
news:3f***********************@freenews.iinet.net. au...
"scott john" <ma******@hotmail.com> wrote in message news:av*******************@newsb.telia.net...
Hello

Im trying to send a mail from a php-program. Im using a test program and the
code for this is as follows:

<?php
$from = me@myaddress.com";
$subject = "Test";
$to = 'm**@myaddress.com;
$mailbody = 'mailbody';
mail($to,$subject,$message,$from);
?>

When I run the page/program I get the following error msg displayed:
"Warning: Failed to Connect in G:\home\server\users\me.com\cgi-bin\send.php
on line 5"

The mail is not delivered. I also tried with <> before and after the value
in the $form. And, of course, the addresses are really ones and both are
presents on the server. Does anyone know what the problem could be?

<phpbeginner>


Have you defined an SMTP server in php.ini ?


Additionally, the $from variable must be a valid header, so change it to:

$from = "From: me@myaddress.com";

You may also need to check which version of PHP you're using, since this header may not be honoured
in your version.

http://php.net/manual/en/function.mail.php

Jul 16 '05 #2

P: n/a
scott john wrote:

Hello

Im trying to send a mail from a php-program. Im using a test program and the
code for this is as follows:

<?php
$from = me@myaddress.com";
$subject = "Test";
$to = 'm**@myaddress.com;
$mailbody = 'mailbody';
mail($to,$subject,$message,$from);
?>

When I run the page/program I get the following error msg displayed:
"Warning: Failed to Connect in G:\home\server\users\me.com\cgi-bin\send.php
on line 5"

The mail is not delivered. I also tried with <> before and after the value
in the $form. And, of course, the addresses are really ones and both are
presents on the server. Does anyone know what the problem could be?


Also, close your quotes for the "to" line:

$to = 'm**@myaddress.com';

not

$to = 'm**@myaddress.com;

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 16 '05 #3

P: n/a
Have you defined an SMTP server in php.ini ?

Hello,

I m developing a site which is located on a webhotell. Im testing my
programs using ftp. If I run a page with phpinfo() then I can seee that
there is a file named php.ini. Its on C:/. My site is on G, so I dont th8ink
I can access that information or edit that file. What do you think?
Additionally, the $from variable must be a valid header, so change it to:
$from = "From: me@myaddress.com";
I changed this, without any result You may also need to check which version of PHP you're using, since this header may not be honoured in your version.

http://php.net/manual/en/function.mail.php


Checked this too. The version in use is the last one

<phpbeginner>

Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.