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
http://php.net/manual/en/function.mail.php
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.
精彩评论