install extention imap
install mailparse : pecl install mailparse
Setelah composer install, jika ada error :
Executing script cache:clear [KO]
[KO]
Script cache:clear returned with error code 1
!!
!! In ArrayNode.php line 220:
!!
!! The child node "key" at path "cspoo_swiftmailer_mailgun" must be configured
!! .
!!
!!
!!
Script @auto-scripts was called via post-update-cmd
Ikuti langkah disini : https://github.com/tehplague/swiftmailer-mailgun-bundle/issues/74#issuecomment-428552701
Untuk proses update jangan menuliskan perintah composer update, tapi lakukan hal berikut :
composer update uvdesk/core-framework
composer update uvdesk/support-center-bundle
composer update uvdesk/mailbox-component
composer update uvdesk/automation-bundle
composer update uvdesk/extension-framework
php bin/console swiftmailer:email:send --to=to@gmail.com --from='from@gmail.com'' --subject="test from cli" --body=test --mailer=smtp.mail.com
smtp
Mailgun
composer require cspoo/swiftmailer-mailgun-bundle php-http/guzzle5-adapter
composer require guzzlehttp/psr7
Error :
doctrine/inflector/lib/Doctrine/Common/Inflector/Inflector.php:90)"} []
[2021-10-13 08:15:51] php.CRITICAL: Call to undefined method cspoo\Swiftmailer\MailgunBundle\Service\MailgunTransport::setPassword() {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to undefined method cspoo\\Swiftmailer\\MailgunBundle\\Service\\MailgunTransport::setPassword() at /opt/webapps/uvdesk/vendor/uvdesk/core-framework/Services/EmailService.php:500)"} []
Solusi :
Pada file vendor/cspoo/swiftmailer-mailgun-bundle/Service/MailgunTransport.php
tambahkan properties dan methods berikut :
/**
* The password for authentication.
*
* @var string
*/
private $password;
/**
* Set the password to authenticate with.
*
* @param string $password
*/
public function setPassword($password)
{
$this->password = $password;
}
/**
* Get the password to authenticate with.
*
* @return string
*/
public function getPassword()
{
return $this->password;
}
Konfigurasi .env :
MAILER_URL=smtp://smtp.mailgun.org:587?encryption=tls&username=ausername&password=apassword
###< symfony/swiftmailer-bundle ###
MAILGUN_DOMAIN="domain.com"
MAILGUN_API_KEY="domain_key"
MAILGUN_SENDER="info@domain.com"
Untuk mengetes mengirim email, gunakan perintah :
php bin/console swiftmailer:email:send --from=<from email> --to=<to email> --subject="Foo" --body="Bar"
MailBox
Contoh konfigurasi yang dapat digunakan adalah seperti ini:
config/packages/uvdesk_mailbox.yaml
Untuk menarik data dari mailbox, dapat menggunakan perintah :
php bin/console uvdesk:refresh-mailbox email-address@example.com
Buat cron job untuk mengeksekusi perintah ini secara rutin, misal setiap 15 menit sekali.
Mac
Jika perintah ini dijalankan di Mac, maka kita akan mendapatkan error :
....
Mailbox refreshed successfully !!!
PHP Fatal error: Uncaught ErrorException: Notice: Unknown: [ALERT] Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library) in Unknown:0
Stack trace:
#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(8, 'Unknown: [ALERT...', 'Unknown', 0, NULL)
#1 {main}
thrown in Unknown on line 0
Fatal error: Uncaught ErrorException: Notice: Unknown: [ALERT] Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library) in Unknown:0
Stack trace:
#0 [internal function]: Symfony\Component\Debug\ErrorHandler->handleError(8, 'Unknown: [ALERT...', 'Unknown', 0, NULL)
#1 {main}
thrown in Unknown on line 0
Referensi