<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Elsayed Awdallah on Medium]]></title>
        <description><![CDATA[Stories by Elsayed Awdallah on Medium]]></description>
        <link>https://medium.com/@eawd?source=rss-afb3d57f96f1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*H_xkEIO9PyeWLbNY.png</url>
            <title>Stories by Elsayed Awdallah on Medium</title>
            <link>https://medium.com/@eawd?source=rss-afb3d57f96f1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 20:16:37 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@eawd/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup PHP to use Postfix to send emails]]></title>
            <link>https://medium.com/@eawd/setup-php-to-use-postfix-to-send-emails-c227eb369554?source=rss-afb3d57f96f1------2</link>
            <guid isPermaLink="false">https://medium.com/p/c227eb369554</guid>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[php]]></category>
            <dc:creator><![CDATA[Elsayed Awdallah]]></dc:creator>
            <pubDate>Sun, 17 Sep 2017 00:00:00 GMT</pubDate>
            <atom:updated>2018-02-24T17:03:06.634Z</atom:updated>
            <content:encoded><![CDATA[<h4>Postfix is a <a href="https://en.wikipedia.org/wiki/Message_transfer_agent">Message Transfer Agent</a> implementation, basically an email server to send and recieve emails, and since PHP doesn’t include an SMTP implementation it needs an external server to do that if you plan on using the internal mail function.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0Pz4IYlahikAfrdb8MZnbQ.jpeg" /><figcaption>A high quality stock photo as per Medium’s recommendation. <a href="https://www.pexels.com/photo/abstract-business-code-coder-270348/">(source</a>)</figcaption></figure><p>While it is not encouraged to install and use your own email server, you might need one for testing purposes or in situations where you have to use PHP’s internal <a href="https://secure.php.net/manual/en/function.mail.php">mail</a> function, so here is how I installed Postfix on Ubuntu and set it up to send emails using PHP’s <a href="https://secure.php.net/manual/en/function.mail.php">mail</a> function.</p><pre>sudo apt-get install postfix</pre><p>It will prompt you to enter a FQDN which is your top domain name e.g. example.org, It’s well explained in the installation process so it shouldn’t be a problem.</p><p>To test your installation enter this command sendmail -tif from@example.org to@example.com Where <em>from@example.com</em> is the email you’re sending from and <em>to@example.com</em> is the email you’re sending to. Write a message then press Ctrl+d, you should now find your message in <em>to@example.com</em> inbox or spam folders.</p><p>Now edit your proper php.ini file for me it was in /etc/php/7.0/fpm/php.ini and edit sendmail_path entry to be:</p><pre>sendmail_path = &quot;sendmail -tif from@example.org&quot;</pre><p>Again <em>from@example.com</em> will be the default email address used as the from email.</p><p>Now reload Postfix and your server then you should be able to send emails using mail function from your server.</p><p>This serverfault answer helped a lot:</p><p><a href="https://serverfault.com/a/289290">Setup ubuntu server to send mail()</a></p><p>And as a bonus, here is how to configure Postfix to use sendgrid as a relay host.</p><p><a href="https://sendgrid.com/docs/Integrate/Mail_Servers/postfix.html">Integrate SendGrid with Postfix - SendGrid Documentation | SendGrid - SendGrid Documentation | SendGrid</a></p><p><em>Originally published at </em><a href="https://eawd.github.io/php/postfix/2017/09/17/install-postfix-php-mail.html"><em>eawd.github.io</em></a><em> on September 17, 2017.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c227eb369554" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>