473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

problem when sending mail

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
3 2758

"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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Eric Timely | last post by:
After a trust with exchange server established the xp_SendMail gives the following error: xp_sendmail: failed with mail error 0x80070005 Prior to the trust everything worked fine. I have...
6
by: Mike the Canadian | last post by:
I am having a very strange problem sending email with php. I have two domains. I can send an email to one domain using php but not the other. If I put both email addresses in the mail command only...
0
by: Fabrice DG | last post by:
Hi all. I don't know if this post is really at the right place but I hope someone can help me.. I developed a NT service, in order to automate mail exchanges between different kind of users This...
3
by: VB Programmer | last post by:
I have an ASPX page where I send out emails through my mail server mail.MyDomain.com. When I send emails to MyName@MyDomain.com it sends PERFECTLY. When I try sending an email to any other address...
4
by: k.visube | last post by:
In my ASP application,i need to send a formatted text mail (i.e with newline characters). here in my application i used a function in javascript which construts the mail body sample snippet ...
2
by: MJ | last post by:
I use the following code to send mails using php usinf PEAR package. When I run this code from command line using the command "php automaticMail.php" the code works fine. But when i run this...
2
by: softbreeze | last post by:
Operating systems: Windows 2003 Enterprise ASP.Net 2.0, IIS 6.0, *** SMTP is not installed *** I have a corporate network that has an SMTP server (10.254.3.30) on it. I have a subnet (10.5.42.0)...
2
by: =?Utf-8?B?YmFyYnlxMTA=?= | last post by:
After sending mail, it leaves the outbox as normal and clears and hits the sent folder, but then I get a popup box that states EMAIL PROBLEM One or more e-mail messages cannot be sent. ...
3
by: swethak | last post by:
Hi, i placed the php in windows server 2003 manually , set the path in Environmental variables , and place the php.ini file in windows. Now php works fine in my server sytem.When i write the...
0
Dormilich
by: Dormilich | last post by:
this is a follow-up thread to this one. http://bytes.com/topic/html-css/answers/863662-form-not-submitted-sometimes I figured out that the mail sending class triggers the described error....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.