views:

69

answers:

4

I have programmed for mailing in php.but how can i send mail through local server?

A: 

You need to setup an SMTP server. You can use iis for this purpose.

Chathuranga Chandrasekara
+2  A: 

A full-on SMTP server would be overkill for just mailing from a script. SMTP is for clients connecting to the server and sending mail.

To send mail from a script, use sendmail or postfix

http://php.net/manual/en/function.mail.php

jonfhancock
+1  A: 

You could also take a look at php.net regarding mailing. Good luck!

Anders
+1  A: 

Assuming the server is already set up to have either SMTP and/or sendmail, then most likely what you are looking for is the mail() function.

Basic usage for that would be something like this:

mail( '[email protected]', 'The subject', 'A short or long message' );

when sending a long message, use the wordwrap() function, to ensure that the message is broken displayed properly by the client.

$message = wordwrap($message, 70);

Of course, if this does not work, then you may need to contact your server administrator to make sure that everything is correctly setup to allow you to send email.

TehDrew