/** * * @param Envelope $envelope * @throws Exception */ public function send(Envelope $envelope) { $mail = $this->prepareMailer($envelope); $mail->Host = $this->connection->getServer(); $mail->Port = $this->connection->getPort(); if (!empty($this->connection->getUsername())) { $mail->SMTPAuth = true; $mail->Username = $this->connection->getUsername(); // SMTP account username $mail->Password = $this->connection->getPassword(); // SMTP account password } if (!$mail->Send()) { throw new Exception($mail->ErrorInfo); } }