Tutorial :how can i send message?


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


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



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


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( 'recipient@email.com', '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.


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

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »