{"action":"opened","issue":{"url":"https://api.github.com/repos/Awilum/monstra-cms/issues/354","labels_url":"https://api.github.com/repos/Awilum/monstra-cms/issues/354/labels{/name}","comments_url":"https://api.github.com/repos/Awilum/monstra-cms/issues/354/comments","events_url":"https://api.github.com/repos/Awilum/monstra-cms/issues/354/events","html_url":"https://github.com/Awilum/monstra-cms/issues/354","id":54018538,"number":354,"title":"SMTP support for Contact plugin","user":{"login":"fadlisaad","id":200320,"avatar_url":"https://avatars.githubusercontent.com/u/200320?v=3","gravatar_id":"","url":"https://api.github.com/users/fadlisaad","html_url":"https://github.com/fadlisaad","followers_url":"https://api.github.com/users/fadlisaad/followers","following_url":"https://api.github.com/users/fadlisaad/following{/other_user}","gists_url":"https://api.github.com/users/fadlisaad/gists{/gist_id}","starred_url":"https://api.github.com/users/fadlisaad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fadlisaad/subscriptions","organizations_url":"https://api.github.com/users/fadlisaad/orgs","repos_url":"https://api.github.com/users/fadlisaad/repos","events_url":"https://api.github.com/users/fadlisaad/events{/privacy}","received_events_url":"https://api.github.com/users/fadlisaad/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-01-12T03:52:23Z","updated_at":"2015-01-12T03:52:23Z","closed_at":null,"body":"By default, the plugin is set to use `mail()` or `sendmail()`, with normally can be used directly with zero configuration. However, SMTP classes were not included, thus while trying to use it with SMTP relay/server, it will throw SMTP class not found error.\r\n\r\nTo solve this issue, you need to follow these simple step, but it will require you to modify the core Monstra file.\r\n\r\nDownload the latest PHPMailer package from https://github.com/Synchro/PHPMailer. This is a fork from the original PHPMailer.\r\n\r\nChoose only two file required: `class.phpmailer.php` and `class.smtp.php`\r\n\r\nRename both file to `PHPMailer.php` and `SMTP.php` respectively.\r\n\r\nCopy both file to the original PHPMailer libraries. The path is \r\n```\r\npath_to_your_monstra/libraries/PHPMailer\r\n```\r\nThis will replace the original PHPMailer.php file, as for SMTP class to work, it will need the same version for both file.\r\n\r\nNext, edit the core Monsta file at \r\n```\r\npath_to_your_monstra/engine/Monsta.php\r\n```\r\nIdentify \r\n```\r\n'PHPMailer' => ROOT . DS .'libraries'. DS . 'PHPMailer'. DS .'PHPMailer.php'\r\n```\r\n and add these line after it:\r\n```\r\n'SMTP' => ROOT . DS .'libraries'. DS . 'PHPMailer'. DS .'SMTP.php'\r\n```\r\nThe modified line should be as below:\r\n```\r\n'PHPMailer' => ROOT . DS .'libraries'. DS . 'PHPMailer'. DS .'PHPMailer.php',\r\n'SMTP' => ROOT . DS .'libraries'. DS . 'PHPMailer'. DS .'SMTP.php'\r\n```\r\n\r\nLocate the plugin at\r\n```\r\npath_to_your_monstra/plugins/contact/contact.plugin.php\r\n```\r\nand add these line: \r\n```\r\n$mail->IsSMTP();\r\n//Enable SMTP debugging\r\n// 0 = off (for production use)\r\n// 1 = client messages\r\n// 2 = client and server messages\r\n$mail->SMTPDebug = 2;\r\n$mail->Host = \"smtp.some-server.com\";\r\n$mail->Port = 25;\r\n```\r\n\r\nTest your configuration and see if there is any problem, you may need to check with the SMTP server."}}