The best way to overcome this problem is sending messages via an SMTP server, however, this functionality is limited as well. It is suitable for simple, mostly text-based notifications in your local environment.
For more details and additional parameters, refer to the PHP documentation. The body of the message can be written in HTML. This is a fair question. If you need to send a large volume of messages in a loop, try an external mailing package. As we have already mentioned, the native PHP mail function has limited functionality when it comes to mass sending. For example, it is not designed for creating engaging email templates that may boost your next campaign or sending a large volume of emails.
Here are several plugins that we can highly recommend:. Pear Mail is a class that provides multiple interfaces for sending emails which is stated in their documentation. Lines should not exceed 70 characters. Optional — The following parameters are optional headers This is typically used to add extra headers such as "From", "Cc", "Bcc".
Example Download. Previous Page Next Page. All Rights Reserved. Share This:. Required — The following parameters are required. Subject of the email to be sent. Check with your host provider how to send emails. Try to send an email from your server without PHP, you can use any email client like Outook. Just after it works, try to configure PHP. Install the "fake sendmail for windows". You then have to configure the "sendmail.
But my best advice for you is to forget about the mail function. It depends on PHP. INI settings, it's configuration is different depending on the platform Linux or Windows , and it can't handle SMTP authentication , which is a big trouble in current days. Too much headache.
INI settings. It comes with many examples, it's very powerful and easy to use. This will not work on a local host, but uploaded on a server, this code should do the trick. Usually a good place to start when you run into problems is the manual. The page on configuring email explains that there's a big difference between the PHP mail command running on MSWindows and on every other operating system; it's a good idea when posting a question to provide relevant information on how that part of your system is configured and what operating system it is running on.
While for a commercial website running your own MTA robably comes quite high on the list of things to do, it is not a trivial exercise - you really need to know what you're doing to get one configured and running securely.
It would make a lot more sense in your case to use a service configured and managed by someone else. There's a simple example here using swiftmailer with gmail or here's an example using phpmailer.
Stack Overflow for Teams — Collaborate and share knowledge with a private group. Create a free Team What is Teams? Collectives on Stack Overflow. Learn more.
How to configure PHP to send e-mail? Ask Question. Asked 8 years, 6 months ago. Active 1 year, 8 months ago. Viewed k times. Please help me..
0コメント