简体   繁体   中英

how can i send message?

我已经为php.mail中的邮件进行了编程,但是如何通过本地服务器发送邮件?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM