
When an email is received for a given domain, SendGrid will send a POST request to your URL which includes information such as the sender, recipient and body, as well as any file attachments.Īnd finally, you’ll need to add an MX record for the domain you’re using. Enter suitable values for your hostname and callback. Once you’ve signed up, navigate to the Developers page using the top navigation and click Parsing Incoming Emails on the right-hand side. You’ll also need an account with SendGrid (the free plan should be more than sufficient for this example application). The database schema defines two tables to hold the users and posts respectively: CREATE TABLE users ( In the real world, you’ll probably want to make the alias something much more difficult to guess, and perhaps restrict access to emails sent from a specific address (though of course this is fairly simple to spoof!). By matching the part before the in the recipient email address, we can determine the user who’s posting. Our application will provide registered users with an email alias. 'public/uploads/'Ĭreate the directories and ensure they are both writeable by the web server. Additionally, add the following lines to specify the directories that will hold log files and uploaded images: 'path.logs' => $basedir. Then, copy the example configuration file to config/config.php and set your own configuration values (such as your database connection details).

'message_format' => '%label% - %date% - %message%' 'log.writer' => new \Slim\Extras\Log\DateTimeFileWriter(array(

#Sendgrid webook unsubscribe update
Update the instantiation of the framework in include/services.php to configure the logger as follows: $app = new Slim(array( To make the app easier to debug, we can implement file-based logging by adding the following to the require section of its composer.json file: "slim/extras": "dev-develop", I’ve based the example code for this article on this Slim Framework skeleton application.
