How to use swiftmailer?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
7 views
Don't know how to use it.

$transport = (new Swift_SmtpTransport('smtp.example.org', 25)) ->setUsername('your username') ->setPassword('your password') ; $mailer = new Swift_Mailer($transport); // Create a message $message = (new Swift_Message('Wonderful Subject')) ->setFrom(['john@doe.com' => 'John Doe']) //from whom // this is probably where it should come a letter //I don't understand why 2 addresses? ->setTo(['receiver@domain.org', 'other@domain.org' => 'A name']) ->setBody('Here is the message itself') ; // Send the message $result = $mailer->send($message);


displays an error

Fatal error: in C:\\OSPanel\\domains\\email\\vendor\\swiftmailer\\swiftmailer\\lib\\classes\\Swift\\Transport\\StreamBuffer.php on line 269


Why I need to write the name and password?

->setUsername('your username') ->setPassword('your password')
by | 7 views

1 Answer

0 like 0 dislike
login and pass from the smtp server that you have transport. And it need to have to start.
by

Related questions

0 like 0 dislike
4 answers
asked Mar 28, 2019 by hell0w0rd
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Apr 13, 2019 by DaniLaFokc
0 like 0 dislike
1 answer
110,608 questions
257,186 answers
0 comments
35,596 users