Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 01-11-2013, 12:10 PM   PM User | #1
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Help me configure mail function in XAMP

Hi Frnds,


As subject line I want to know how to configure mail function from XAMPP ..



Please help.

Thanks
Nani
nani_nisha06 is offline   Reply With Quote
Old 01-11-2013, 12:39 PM   PM User | #2
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
XAMPP comes with a mail server tool called, as I recall, TomCat(?). I wouldn't go near it in terms of trying to test emails locally - it's a nightmare to set-up .

I use Test Mail Server Tool - it's dead easy.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Users who have thanked AndrewGSW for this post:
nani_nisha06 (01-14-2013)
Old 01-11-2013, 07:44 PM   PM User | #3
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
XAMPP comes with a mail server tool called, as I recall, TomCat(?). I wouldn't go near it in terms of trying to test emails locally - it's a nightmare to set-up .

I use Test Mail Server Tool - it's dead easy.
Andrew,

ya, send mail is really messy to use always what we get at end is crash report that's it ...

any how can I user test mail server ....?

Any step by step workout?

Thanks A head....
nani_nisha06 is offline   Reply With Quote
Old 01-11-2013, 08:42 PM   PM User | #4
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Quote:
how can I user test mail server ....?
Erm, install the application. Before you test your PHP (that sends an email) start the application. It will pop-up automatically with the email when it is sent.
Added: If you have a default email-client (which you probably will have) the message will pop-up in, for example, Windows Live Mail or Outlook(Express).

BTW Spending too much time testing locally-sent emails is not particularly fruitful; you'll only have to do it all over again remotely . But the application I have referred is dead simple.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS

Last edited by AndrewGSW; 01-11-2013 at 08:52 PM..
AndrewGSW is offline   Reply With Quote
Old 01-12-2013, 10:11 AM   PM User | #5
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
Erm, install the application. Before you test your PHP (that sends an email) start the application. It will pop-up automatically with the email when it is sent.
Added: If you have a default email-client (which you probably will have) the message will pop-up in, for example, Windows Live Mail or Outlook(Express).

BTW Spending too much time testing locally-sent emails is not particularly fruitful; you'll only have to do it all over again remotely . But the application I have referred is dead simple.
Andrew,

whole concept of my PHP scrip is to fetch the data and send the mail to the DL list mentioned in the header.

now i am using XAMPP for development and need to test whether the right information is going.

Well with mail test server I have again failed my I dont know what mistake i am doing I have even try to check for any crash report but i dont find it anywhere.

Please help me ..

Regards,
Nani
nani_nisha06 is offline   Reply With Quote
Old 01-12-2013, 10:44 AM   PM User | #6
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
Sorry, I'm not using XAMPP currently so I don't know where an error log might be located.

The problem might be in your script, so you could post some code and start a separate thread. However, your script may actually be working if you tried to send the email from your live site (rather than locally).

Assuming your page uses variables like $email, $message, etc., use

Code:
print_r($email); // etc.
just before sending the email. Then View the Source of the page to read these values to make sure they are correctly formed. var_dump() is another such function.

Add the following so that PHP will display all errors:

PHP Code:
error_reporting(E_ALL);
ini_set('display_errors''1'); 
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 01-13-2013, 04:35 PM   PM User | #7
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Please find below code !!!
PHP Code:
<?php
include_once "C:/xampp/htdocs/sam/include/db.php";

//execute the SQL query and return records
$result "SELECT * FROM $testcert WHERE Date = DATE_ADD(curdate(), INTERVAL 45 DAY)";
$check=mysql_query($result);

//fetch tha data from the database 
while ($row mysql_fetch_array($check)) {
    
$to "XXXXXXXXXXXXXXXX@yahoo.com";
    
$subject "Test mail";
    echo 
$message $row['description'];
    
$from "testmailtome@google.com";
    
$headers "From:" $from;
    
mail($to,$subject,$message,$headers);
    echo 
"Mail Sent.";
    }
//close the connection
mysql_close();
?>
please help me if it the right way.................

Quote:
Originally Posted by AndrewGSW View Post
Sorry, I'm not using XAMPP currently so I don't know where an error log might be located.

The problem might be in your script, so you could post some code and start a separate thread. However, your script may actually be working if you tried to send the email from your live site (rather than locally).

Assuming your page uses variables like $email, $message, etc., use

Code:
print_r($email); // etc.
just before sending the email. Then View the Source of the page to read these values to make sure they are correctly formed. var_dump() is another such function.

Add the following so that PHP will display all errors:

PHP Code:
error_reporting(E_ALL);
ini_set('display_errors''1'); 
nani_nisha06 is offline   Reply With Quote
Old 01-13-2013, 05:05 PM   PM User | #8
AndrewGSW
Senior Coder

 
Join Date: Apr 2011
Location: London, England
Posts: 2,120
Thanks: 15
Thanked 354 Times in 353 Posts
AndrewGSW will become famous soon enough
This would mean $testcert is an already defined variable which contains the name of a table? Otherwise, looks okay at a glance.

But the mysql library is deprecated and you should use mysqli or PDO in preference, and prepared statements.
__________________
"I'm here to save your life. But if I'm going to do that, I'll need total uninanonynymity." Me Myself & Irene.
Validate your HTML and CSS
AndrewGSW is offline   Reply With Quote
Old 01-13-2013, 08:16 PM   PM User | #9
Ctechinfo
New Coder

 
Join Date: Sep 2012
Posts: 88
Thanks: 3
Thanked 3 Times in 3 Posts
Ctechinfo is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
XAMPP comes with a mail server tool called, as I recall, TomCat(?). I wouldn't go near it in terms of trying to test emails locally - it's a nightmare to set-up .

I use Test Mail Server Tool - it's dead easy.
It's actaully Mercury..

Tomcat is an Apache addon for Java:
http://tomcat.apache.org/

To answer the OP's question. I haven't used Mercury in ages so I don't know much about it... but google might be able to give you some insite..
here is a direct link to the search
Ctechinfo is offline   Reply With Quote
Users who have thanked Ctechinfo for this post:
nani_nisha06 (01-14-2013)
Old 01-14-2013, 01:09 PM   PM User | #10
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by AndrewGSW View Post
This would mean $testcert is an already defined variable which contains the name of a table? Otherwise, looks okay at a glance.

But the mysql library is deprecated and you should use mysqli or PDO in preference, and prepared statements.
Anderw,

Agreed coz even I get mail sending promt while doing but I dont see any mails....


Regards,
naveen
nani_nisha06 is offline   Reply With Quote
Old 01-14-2013, 01:32 PM   PM User | #11
hinch
Regular Coder

 
hinch's Avatar
 
Join Date: Sep 2005
Location: UK
Posts: 921
Thanks: 25
Thanked 79 Times in 79 Posts
hinch is on a distinguished road
just edit php.ini to send via an external smtp relay? or use something like swiftmail or sending your mail that supports multiple transports.

that way your email goes outbound and will arrive on a proper inbound account in exactly the same format as you would find on your live server.
__________________
A programmer is just a tool which converts caffeine into code

My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
My hobby: http://www.angel-computers.co.uk
My life: http://www.furious-angels.com
hinch is offline   Reply With Quote
Old 01-14-2013, 02:28 PM   PM User | #12
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by hinch View Post
just edit php.ini to send via an external smtp relay? or use something like swiftmail or sending your mail that supports multiple transports.

that way your email goes outbound and will arrive on a proper inbound account in exactly the same format as you would find on your live server.
Hinch,

I have a inbuild sendmail server & as suggested by andrew I have also installed
Code:
http://www.toolheap.com/test-mail-server-tool/
by disabling send mail still i dont find any solution ...

Please help me incase you have any specific procedure with specific mail server like swiftmail.

I am confused a lot.

Thanks
Nani
nani_nisha06 is offline   Reply With Quote
Old 01-14-2013, 02:33 PM   PM User | #13
hinch
Regular Coder

 
hinch's Avatar
 
Join Date: Sep 2005
Location: UK
Posts: 921
Thanks: 25
Thanked 79 Times in 79 Posts
hinch is on a distinguished road
you don't need to run a local mail server, you're connected to the internet. your ISP provides you with an open access relaying SMTP server.

edit php.ini there's 4-5 lines in there were you can specify an outbound relay mail server.

If doing it this way you can just use the standard php mail() command with no changes and it'll work fine.

Alternatively you can use the swiftmail library for php and set the SwiftMailer::Transport to be SMTP and give it your ISP's outbound relay server (usually something like smtp.myisp.com or mail.myisp.com)

Both methods will work both are well described on google and both the PHP homepage and the SwiftMailer homepage.

If you're running on anything but a unix machine your local mail server attempt just wont work.
__________________
A programmer is just a tool which converts caffeine into code

My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
My hobby: http://www.angel-computers.co.uk
My life: http://www.furious-angels.com
hinch is offline   Reply With Quote
Old 01-14-2013, 02:43 PM   PM User | #14
nani_nisha06
Regular Coder

 
Join Date: Oct 2012
Location: mother land --india
Posts: 159
Thanks: 37
Thanked 2 Times in 2 Posts
nani_nisha06 is an unknown quantity at this point
Quote:
Originally Posted by hinch View Post
you don't need to run a local mail server, you're connected to the internet. your ISP provides you with an open access relaying SMTP server.

edit php.ini there's 4-5 lines in there were you can specify an outbound relay mail server.

If doing it this way you can just use the standard php mail() command with no changes and it'll work fine.
I have already configured php.ini, not sure if you talking about the same 4-5 lines. Any post describe same....I have tried google but don't see any effective results.

Thanks,
Nani
nani_nisha06 is offline   Reply With Quote
Old 01-14-2013, 02:50 PM   PM User | #15
hinch
Regular Coder

 
hinch's Avatar
 
Join Date: Sep 2005
Location: UK
Posts: 921
Thanks: 25
Thanked 79 Times in 79 Posts
hinch is on a distinguished road
PHP Code:
[mail function]
; For 
Win32 only.
http://php.net/smtp
SMTP localhost
http://php.net/smtp-port
smtp_port 25

; For Win32 only.
http://php.net/sendmail-from
sendmail_from you@yourdomain 
Change SMTP= to your isp's mail server change send from to whatever you like.

restart apache/services for xmpp

as noted in the comments above and in my previous post its all well documented on the php.net website (even in your native language!)
__________________
A programmer is just a tool which converts caffeine into code

My work: http://www.fcsoftware.co.uk && http://www.firstcontactcrm.com
My hobby: http://www.angel-computers.co.uk
My life: http://www.furious-angels.com
hinch is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 08:56 PM.


Advertisement
Log in to turn off these ads.