I do not have proper excellence at php programming. I wrote below script after reading several articles. Anyway that form-to-mail script doesn't work. form action is connected to following code -
<?php
-
require_once "send1.php";
-
-
$from = "Sandra Sender <user@myweb.com.com>";
-
$to = "Ramona Recipient <myemail@gmail.com>";
-
$subject = "Hi!";
-
$body = "Hi,\n\nHow are you?";
-
-
$host = " mail.myweb.com";
-
$username = "user@myweb.com";
-
$password = "mypassword";
-
-
$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>");
-
}
-
?>
-
send1.php is as follows. -
<?php
-
$to = "myemail@gmail.com";
-
$subject = "Hi!";
-
$body = "Hi,\n\nHow are you?";
-
if (mail($to, $subject, $body)) {
-
echo("<p>Message successfully sent!</p>");
-
} else {
-
echo("<p>Message delivery failed...</p>");
-
}
-
?>
-
this gets a error massage as follows. -
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in ....
-
-
Message delivery failed...
-
-
-
Fatal error: Class 'Mail' not found in D:\websites\fff\fff.com\wwwroot\send.php on line 16
-
--------------------------------------------
I don't have a server and i'm taking server from a remote company. they says mail server authentication is the prob. anyway it doesn't work.
please help me...
thanks.
1 2224 Atli 5,058
Expert 4TB
Hi. Welcome to TSDN!
Your fist warning says it all, really: -
Warning: mail() [function.mail]: Failed to connect to mailserver at "localhost" port 25, verify your "SMTP" and "smtp_port" setting in php.ini or use ini_set() in ....
-
So, as the error mentions, try giving the "smtp_port" and "SMTP" settings proper values.
Like for example: -
ini_set("smtp_port", 25);
-
ini_set("SMTP", "mail.example.mysmtpserver.com");
-
These values are obviously made up. You will have to replace them with real values.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Google Mike |
last post by:
There seems to be a lot of white noise in trying to understand SMTP
that requires authentication when searching the newsgroups via Google
Groups or searching the PHP.net website. The PHP fsockopen...
|
by: baustin75 |
last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie
only when debugging in php designer 2005
--------------------------------------------------------------------------------
...
|
by: Brett Porter |
last post by:
Hi,
My ASP.Net applications frequently make use of the System.Web.Mail
namespace to send emails. I have set SmtpMail.SmtpServer = "localhost"
and the emails send out fine UNTIL an email is sent...
|
by: RN |
last post by:
I am tired of sending mail from the built-in SMTP service for so many
reasons (errors are nondescriptive in the event log, it doesn't let me
control which IP address it sends from, and it...
|
by: Eric Sheu |
last post by:
Greetings,
I have been searching the web like mad for a solution to my SMTP problem. I
am using Windows Server 2003 and ASP.NET 2.0 w/ C# to send out e-mails from a
web site I have created to...
|
by: rekaeps |
last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer. Also, in the same scenario,...
|
by: dnuos |
last post by:
We are developing an ASP.NET 2.0 (C#) application, and I'm having troubles
sending e-mail from the server when accessing the web site from a separate
client computer.
Here's some details:
...
|
by: AbraAbraCadabra |
last post by:
Ok I think I've almost got my problem solved. I am using this code to send
mail.
I am simply pasting it into an .ASP page. Why doesn't this code work? I do
have
..NET 2.0 installed, but I...
|
by: ibiza |
last post by:
Hi all,
I am trying to use the System.Net.Mail class for the first time, with
ASP.NET 2.0.
I setup everything according to
http://www.codeproject.com/aspnet/EasySMTP_package.asp, which gives...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |