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 2237 Atli 5,058
Recognized Expert Expert
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 API's notes
on php.net provide the routine to connect, unauthenticated, to send
messages. But if you need authentication, people want you to...
|
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
--------------------------------------------------------------------------------
Hello,
I have a very simple problem but cannot seem to figure it out. I have a
very simple php script that sends a test email to myself. When I...
|
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 to the same
address as the server / website address i.e.
If the web address is www.servername.com an email sent using SMTPMail
to...
|
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 identifies itself as the
computer name which is not in domain.com format, triggering spam filter
problems).
Instead, I want to have my code send through...
|
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 the members of my organization. I think my problem
is incorrectly setting the settings on my server or an authentication
problem. Here is the code I...
| |
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, I'm having trouble writing to
the server's event log.
Here's some details:
Server and workstation both in the same workgroup
Logged into server...
|
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:
Server and client computers both in the same workgroup
Logged into server as local Administrator
Logged into client as a local user that is only in the...
|
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 haven't done any configuration to it. Am I
missing something?
'Create a new MailMessage object and specify the"From" and "To" addresses
Dim Email...
|
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 me
a working environment for sending mails.
I am sure the code is correct, there are no errors and everything seems
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
| |
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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 we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...
| |