https://github.com/damir-sijakovic/sendmails
Two functions that send mail with html message and attachment.
https://github.com/damir-sijakovic/sendmails
attachment html mail php sendmail
Last synced: about 2 months ago
JSON representation
Two functions that send mail with html message and attachment.
- Host: GitHub
- URL: https://github.com/damir-sijakovic/sendmails
- Owner: damir-sijakovic
- License: mit
- Created: 2021-06-11T07:07:12.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-11T09:41:26.000Z (about 5 years ago)
- Last Synced: 2025-03-25T06:26:33.300Z (over 1 year ago)
- Topics: attachment, html, mail, php, sendmail
- Language: PHP
- Homepage:
- Size: 2.93 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Send mail functions
Two functions to send mail with html message and attachment.
## sendHtmlMail($to, $from, $subject, $html, &$msg=null)
Arguments:
* to - destination email address
* from - sender email address
* subject - email subject
* html - message in html format (can be plain text)
* msg - optional arg that pass error message
Return:
Boolean, error messages are passed through msg reference argument.
## sendAttachment($to, $from, $subject, $html, $filename, $filepath, &$emsg=null)
* to - destination email address
* from - sender email address
* subject - email subject
* html - message in html format (can be plain text)
* msg - optional arg that pass error message
* filename - file name of attachment in email
* filepath - path to file you want to send
* emsg - optional arg that pass error message
Return:
Boolean, error messages are passed through emsg reference argument.
Example:
$msg = '';
$html = '
Hello
This is paragraph.
';
$sendOk = sendAttachment('destination@fake.fake', 'from@fake.fake', 'hello subject', $html, 'somefile2.pdf', __DIR__ . '/somefile2.pdf', $msg);
if (!sendOk)
{
die($msg);
}
## Issues
Attachments don't work on my webhosts email but do work on gmail.
Sometimes it takes few minutes for mail to appear.
### Have Fun
`Developed and tested under 5.4.118-1-manjaro/xfce/docker/portainer`