Page 1 of 1
Mail Sending Error
Posted: Mon Jun 12, 2006 1:54 am
by my_raj_raj2
Hi,
I have Problem in sending mail from localhost.
The code is:
Code: Select all
$mailfrom="admin@admin.com";
$email="my_raj_raj@yahoo.com";
$subject='hi';
$data="This is mail part";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "From: ". $mailfrom."\r\n";
mail($email,$subject,$data,$headers);
When I excute the program I got the error
Warning: 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 d:\appserv\www\mail.php on line 28
Anybody know what is the solution for it?
Thanks.
Posted: Mon Jun 12, 2006 2:18 am
by Chris Corbyn
Hmm, change the SMTP server configuration in php.ini? Or start an SMTP server running on localhost?
Mail Sending Error
Posted: Mon Jun 12, 2006 4:48 am
by my_raj_raj2
Hi ,
Thanks for ur reply.
Already I set the smtp settings in php ini.
Code: Select all
SMTP = mail.domain.com
sendmail_from = me@localhost.com
Can u tell me any smtp running in apache?(where i download it?)
I configure php in 81 port.But smtp in 25 port is make any problem?
Thanks
Posted: Mon Jun 12, 2006 5:21 am
by jayshields
change mail.domain.com to localhost. leave the port as 25.
Posted: Mon Jun 12, 2006 6:36 am
by Chris Corbyn
Apache isn't an SMTP server, it's HTTP.
Either use a remote server or install an SMTP service. Windows servers have one you can enable in the control panel. Linux servers can use a number of things like sendmail, qmail, exim...
Posted: Mon Jun 12, 2006 6:41 am
by twigletmac
Alternatively, you can often use your ISP's SMTP server to send mail from PHP. Try using the same SMTP server name as you have for sending mail from your e-mail client.
Mac
Mail Sending Error
Posted: Tue Jun 13, 2006 3:07 am
by my_raj_raj2
Hi all,
Thanks for ur Replies.
I try several times but I got same error.
I change the settings in php.ini
; For Win32 only.
SMTP = mail.aj16.kserver.aj.com (Domain name in smtp server)
; For Win32 only.
sendmail_from =
kserver@aj.com
I configure the smtp in localhost is make any problem?
Anybody tell me is that any possibilities for mail send from localhost?
Thank u.
Mail Sending Error
Posted: Wed Jun 14, 2006 10:12 am
by my_raj_raj2
Hi all,
If any possibilites for mail send using third party smtp(Free smtp services).
Thanks in advance
Re: Mail Sending Error
Posted: Wed Jun 14, 2006 12:56 pm
by Chris Corbyn
my_raj_raj2 wrote:Hi all,
If any possibilites for mail send using third party smtp(Free smtp services).
Thanks in advance
http://www.swiftmailer.org/ will work with something like a Gmail account or any other SMTP server you can get access to.
Mail Sending Error
Posted: Thu Jun 15, 2006 8:06 am
by my_raj_raj2
Pimptastic | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi,
Thanks for ur reply.
I download the Swift-1.2.1 and run this in my localhost.
Run this coding
Code: Select all
<?php
//Specify secure TLS when we make the connection
$swift = new Swift(new Swift_SMTP_Connection('smtp.gmail.com', SWIFT_SECURE_PORT, SWIFT_TLS));
//Log in to the server
$swift->authenticate('myaccount@gmail.com', 'myaccountpassword');
if (!$swift->hasFailed())
{
$swift->send(
'"To User" <shiri@gmail.com>',
'"Your name" <shiri@aj.com>',
'The subject',
'Your message'
);
$swift->close();
}
?>
But I got this error.
Parse error: syntax error, unexpected T_STRING in d:\appserv\www\Swift.php on line 65
I don't know Why it is appear?
Bye.
Pimptastic | Please use Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Posted: Thu Jun 15, 2006 8:33 am
by JayBird
Are you using the correct version of Swift Mailer
There are two versions...one for PHP5 and one for PHP4
Mail Sending Error
Posted: Fri Jun 16, 2006 1:22 am
by my_raj_raj2
Hi,
I am using PHP 4.4.1.
And I download the Swift-1.2.1-php4.zip.
But Now I got the error below
Fatal error: Cannot instantiate non-existent class: swift_smtp_connection in d:\appserv\www\swift_mail.php on line 4
Php code is below
Code: Select all
<?php
require 'Swift.php';
//Specify secure TLS when we make the connection
$swift = new Swift(new Swift_SMTP_Connection('smtp.gmail.com', SWIFT_SECURE_PORT, SWIFT_TLS));
//Log in to the server
$swift->authenticate('myaccount@gmail.com', 'myaccountpassword');
if (!$swift->hasFailed())
{
$swift->send(
'"To User" <shiri@gmail.com>',
'"Your name" <shiri@aj.com>',
'The subject',
'Your message'
);
$swift->close();
}
?>
Help Me. what is the wrong in this coding?
Thank u.
Posted: Fri Jun 16, 2006 4:37 am
by Chris Corbyn
You haven't included the Swift_SMTP_Connection.php file

Posted: Fri Jun 16, 2006 4:40 am
by Chris Corbyn
Hmm... I'm not sure TLS will work with a windows installation of PHP. It requires OpenSSH to be compiled with PHP.... does windows PHP support ssl:// and tls:// protocols?
Mail Sending Error
Posted: Mon Jun 19, 2006 7:56 am
by my_raj_raj2
I include the Swift_SMTP_Connection.php file.
But mail was not send to users.
if any possiblites for mail sending (windows php)?