Skip to content

Commit

Permalink
update for new version
Browse files Browse the repository at this point in the history
  • Loading branch information
BMTmohammedtaha committed Dec 27, 2023
1 parent d240857 commit 1955e07
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,10 @@ composer require effectra/mail
To send emails using the Effectra\Mail package, you need to create a mailer instance. The `MailerFactory` class provides a convenient way to create the mailer instance:

```php
use Effectra\Mail\Factory\MailerFactory;

$mailerFactory = new MailerFactory();
use Effectra\Mail\Mailer;

// Create a mailer instance
$mailer = $mailerFactory->createMailer(
$mailer = new Mailer(
'smtp', // Mail driver (e.g., 'smtp', 'sendmail')
'mail.example.com', // Mail server host
587, // Mail server port
Expand All @@ -44,19 +42,20 @@ $mailer = $mailerFactory->createMailer(
Once you have a mailer instance, you can use it to send emails. The `Mailer` class provides methods for setting the email recipients, subject, content, and more. Here's an example of sending an email:

```php
$mail = new Mail();
// Set email recipients
$mailer->to('[email protected]');
$mailer->cc('[email protected]');
$mailer->bcc('[email protected]');
$mail->to('[email protected]');
$mail->cc('[email protected]');
$mail->bcc('[email protected]');

// Set email subject and content
$mailer->subject('Hello, world!');
$mailer->text('This is the plain text content of the email.');
$mailer->html('<p>This is the HTML content of the email.</p>');
$mail->subject('Hello, world!');
$mail->text('This is the plain text content of the email.');
$mail->html('<p>This is the HTML content of the email.</p>');

// Send the email
try {
$mailer->send();
$mailer->send($mail);
echo 'Email sent successfully!';
} catch (Exception $e) {
echo 'An error occurred while sending the email: ' . $e->getMessage();
Expand Down

0 comments on commit 1955e07

Please sign in to comment.