{"id":57819,"date":"2022-12-21T03:01:34","date_gmt":"2022-12-20T17:01:34","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/ITblog\/?p=57819"},"modified":"2022-12-20T19:48:02","modified_gmt":"2022-12-20T09:48:02","slug":"php-mail-via-exim-better-return-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-mail-via-exim-better-return-primer-tutorial\/","title":{"rendered":"PHP Mail via Exim Better Return Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/snapshotexim.jpg\"><img decoding=\"async\" style=\"float:left; border: 15px solid pink;\" alt=\"PHP Mail via Exim Better Return Primer Tutorial\" src=\"https:\/\/www.rjmprogramming.com.au\/snapshotexim.jpg\" title=\"PHP Mail via Exim Better Return Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">PHP Mail via Exim Better Return Primer Tutorial<\/p><\/div>\n<p>We are exploring a way to improve on the PHP <a target=_blank title='PHP mail function' href='https:\/\/www.php.net\/manual\/en\/function.mail.php'>mail<\/a> return value telling you nothing about whether the email gets off to the intended recipient.  One step, here at RJM Programming, is to verify if the email has immediately been sent off according to our <a target=_blank title='Exim' href='https:\/\/www.exim.org\/'>Exim<\/a> mail server logs.<\/p>\n<p>We are turning to a <a target=_blank title='crontab information from computerhope ... thanks' href='http:\/\/www.computerhope.com\/jargon\/c\/cron.htm'>crontab<\/a> operated (ie. scheduled) call to a new &#8230;<\/p>\n<ul>\n<li><a target=_blank title='Korn Shell' href='https:\/\/en.wikipedia.org\/wiki\/KornShell'>Korn Shell<\/a> script called <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/snapshotexim.ksh_GETME\">snapshotexim.ksh<\/a> &#8230; which looks out for the existence of a &#8230;<\/li>\n<li>file in our <a target=_blank title=Apache href='https:\/\/www.apache.org\/'>Apache<\/a> web server&#8217;s <a target=_blank title='Document Root' href='https:\/\/httpd.apache.org\/docs\/2.4\/urlmapping.html'>Document Root<\/a> called snapshotexim.txt<\/li>\n<\/ul>\n<p> &#8230; to, in our <a target=_blank title='MAMP' href='http:\/\/www.mamp.info'>MAMP<\/a> local Apache web server wooooorrrrrlllllddd would work with either &#8230;<\/p>\n<p><code><br \/>\n   echo '\/Applications\/MAMP\/htdocs\/ \"2022-12-20 11:4[01]\"' > snapshotexim.txt<br \/>\n   ksh .\/snapshotexim.ksh  # may populate \/Applications\/MAMP\/htdocs\/snapshotexim.php<br \/>\n<\/code><\/p>\n<p> &#8230; or &#8230;<\/p>\n<p><code><br \/>\n  echo '' > snapshotexim.txt<br \/>\n  ksh .\/snapshotexim.ksh \/Applications\/MAMP\/htdocs\/ \"2022-12-20 11:4[01]\"  # may populate \/Applications\/MAMP\/htdocs\/snapshotexim.php<br \/>\n<\/code><\/p>\n<p> &#8230; methodologies to place a relevant &#8220;slice&#8221; (dated 2022-12-20 11:40 or 2022-12-20 11:41) of the Exim mail server log into a file in our Apache web server&#8217;s Document Root called snapshotexim.php for ongoing local work to follow.<\/p>\n<p>We prefer the first way because our future PHP interfacing can better write out &#8220;the intelligence&#8221; into snapshotexim.txt itself.<\/p>\n<p>Up with crontab, in a Korn Shell procedure that runs every minute, we place (code like) &#8230;<\/p>\n<p><code><br \/>\nif [ -f \"$HOME\/snapshotexim.txt\" ]; then<br \/>\n if [ -f \"\/etc\/init.d\/snapshotexim.ksh\" ]; then<br \/>\n  ksh \/etc\/init.d\/snapshotexim.ksh<br \/>\n fi<br \/>\nfi<br \/>\n<\/code><\/p>\n<p> &#8230; ready for our journey of discovery to continue!<\/p>\n<p><b><i>Did you know?<\/i><\/b><\/p>\n<p>If you are thinking of implementing a solution of this ilk, within the next phase of the procedures we&#8217;ll tackle into the future, you will need a PHP reader of snapshotexim.php above, via file_get_contents or HTML and Javascript and Ajax reader such as <a target=_blank href=\"https:\/\/www.rjmprogramming.com.au\/eximsnapshot.php_GETME\">eximsnapshot.php<\/a> as some sort of starting point.<\/p>\n<p>If this was interesting you may be interested in <a title='Click here to see topics in which you might be interested' href='#d57819' onclick='var dv=document.getElementById(\"d57819\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"https:\/\/www.rjmprogramming.com.au\/ITblog\/tag\/exim\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d57819' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>We are exploring a way to improve on the PHP mail return value telling you nothing about whether the email gets off to the intended recipient. One step, here at RJM Programming, is to verify if the email has immediately &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/php-mail-via-exim-better-return-primer-tutorial\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12,29,33,37],"tags":[85,274,327,1750,380,2751,4180,418,677,714,716,738,2240,744,932,997,3420,3998,1138,2664,2762,2213,1411],"class_list":["post-57819","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-software","category-tutorials","tag-apache","tag-crontab","tag-did-you-know","tag-document-root","tag-email","tag-exim","tag-exim-mail-server","tag-file","tag-korn-shell","tag-local-web-server","tag-log","tag-mail","tag-mail-server","tag-mamp","tag-php","tag-programming","tag-return","tag-return-value","tag-shell","tag-slice","tag-snippet","tag-tutotial","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/57819"}],"collection":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/comments?post=57819"}],"version-history":[{"count":8,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/57819\/revisions"}],"predecessor-version":[{"id":57827,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/57819\/revisions\/57827"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=57819"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=57819"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=57819"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}