https://github.com/pushkar-anand/easy-mail
A wrapper for php's mail function that allows you to easily construct and send mails.
https://github.com/pushkar-anand/easy-mail
mail php
Last synced: 23 days ago
JSON representation
A wrapper for php's mail function that allows you to easily construct and send mails.
- Host: GitHub
- URL: https://github.com/pushkar-anand/easy-mail
- Owner: pushkar-anand
- License: mit
- Created: 2018-06-12T18:43:44.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T13:51:44.000Z (about 1 year ago)
- Last Synced: 2025-05-07T05:49:01.380Z (23 days ago)
- Topics: mail, php
- Language: PHP
- Homepage:
- Size: 31.3 KB
- Stars: 2
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-mail
A wrapper for php's mail function that allows you to easily construct and send mails.
- [Install](#install)
- [Usage](#usage)
- [License](#license)## Install
With composer:
```bash
composer require pushkar/easy-mail
```## Usage
```php
require_once "../../path/to/vendor/autoload.php";use EasyMail\Mail;
//Example 1
$mail = new Mail("[email protected]");
$mail->setSubject("Subject");
$mail->setMsg("Msg");
if($mail->sendMail()) {
echo "Mail Sent.";
}//Example 2
$mail = new Mail("[email protected]", "Subject", "Msg');
if($mail->sendMail()) {
echo "Mail Sent.";
}//Some methods
//For a reply-to header
$mail->addReplyTo("[email protected]", Name);//For html email
$mail->isHtml(true);//For adding custom header
$mail->customHeaders($header);//set From
$mail->setFrom($email, $name);//All methods
isValidEmail(string);
isHtml(bool);
setSubject(string);
setMsg(string);
addCC(string);
addBcc(string);
customHeader(string);
addReplyTo(string, string|null);
setFrom(string, string|null);
setPriority(int);
addAttachment(string);
setEncoding(string);
sendMail();```
## License
Copyright (c) 2018 [Pushkar Anand](https://pushkaranand.me/). Under MIT License.