Simple mail sending program in php




















All Rights Reserved. W3Schools is Powered by W3. Specifies the subject of the email. Note: This parameter cannot contain any newline characters. Defines the message to be sent. Lines should not exceed 70 characters. Specifies additional headers, like From, Cc, and Bcc. This way, your email samples will never go to the inboxes of the real customers. Swift Mailer is another popular package for sending emails in PHP.

It is feature-rich, well covered by documentation, and pretty straightforward in use. Besides that, Swift Mailer offers enhanced security and handles large attachments and images with low memory usage. Below we will demonstrate a simple example of the same sending booking confirmation we used above. It deserves a separate article and a tutorial. You will find it here. In this article, we have described the basic PHP email sending principles, syntax, and parameters. Moreover, we have reviewed the main ways of sending emails with PHP: its built-in mail function and the most popular external mail packages.

However, PHP mail function can still be an option if you are sending plain text notification via localhost. PHP must be configured correctly in the php. Open php. Windows users should ensure that two directives are supplied.

The first is called SMTP that defines your email server address. Linux users simply need to let PHP know the location of their sendmail application. PHP makes use of mail function to send an email.

This function requires three mandatory arguments that specify the recipient's email address, the subject of the the message and the actual message additionally there are other two optional parameters. Specifies the subject of the email. This parameter cannot contain any newline characters. Defines the message to be sent. Lines should not exceed 70 characters. Specifies additional headers, like From, Cc, and Bcc.



0コメント

  • 1000 / 1000