{"id":7451,"date":"2014-04-26T05:05:58","date_gmt":"2014-04-25T19:05:58","guid":{"rendered":"http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=7451"},"modified":"2014-04-26T05:05:58","modified_gmt":"2014-04-25T19:05:58","slug":"perl-cgi-email-primer-tutorial","status":"publish","type":"post","link":"https:\/\/www.rjmprogramming.com.au\/ITblog\/perl-cgi-email-primer-tutorial\/","title":{"rendered":"Perl CGI Email Primer Tutorial"},"content":{"rendered":"<div style=\"width: 230px\" class=\"wp-caption alignnone\"><a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/email_sender.html\"><img decoding=\"async\" style=\"float:left;border: 15px solid pink;\" alt=\"Perl CGI Email Primer Tutorial\" src=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Perl_CGI_Email.jpg\" title=\"Perl CGI Email Primer Tutorial\"  \/><\/a><p class=\"wp-caption-text\">Perl CGI Email Primer Tutorial<\/p><\/div>\n<p>Today we again venture into the world of CGI (<a target=_blank title='CGI information from Wikipedia ... thanks' href='http:\/\/en.wikipedia.org\/wiki\/Common_Gateway_Interface'>Common Gateway Interface<\/a>) on our Apache\/PHP\/MySql web server, this time to investigate using the Perl CGI to send emails via the Linux <i><a target=_blank title='sendmail information via Wikipedia' href='http:\/\/en.wikipedia.org\/wiki\/Sendmail'>sendmail<\/a><\/i> command.<\/p>\n<p>Found with the use of <i><a target=_blank title='sendmail syntax advice from Computerhope ... thanks' href='http:\/\/www.computerhope.com\/unix\/usendmai.htm'>sendmail<\/a><\/i> there are configurations you probably shouldn&#8217;t touch, that you should work &#8220;with&#8221; (rather than against &#8230; doh!) &#8230; and for advice on this would strongly suggest getting the local web server advice on this via the command <i>perldoc -q &#8220;How do I send mail&#8221;<\/i> &#8230; would like to say that this idea was dreamed up by yours truly, but yet again, and again, and again, and again, and again (are you getting bored because I&#8217;m not &#8230; it&#8217;s a wet day), and again, and again, and again, and again it was an Open Source (and again) link <a target=_blank title='CentOS Perl sendmail help ... thanks' href='http:\/\/stackoverflow.com\/questions\/1054029\/why-cant-i-send-email-using-perl-cgi-script-on-centos'>here<\/a> that helped.  And to get here did this <a target=_blank title='CentOS sendmail perl ... at Google ... thanks' href='https:\/\/www.google.com.au\/?gfe_rd=ctrl&#038;ei=3s4rU6TsBsHC8gfOtYHAAw&#038;gws_rd=cr#q=CentOS+sendmail+perl'>search<\/a> (notice how CentOS is mentioned &#8230; ie. get specific).<\/p>\n<p>This last bit is separate to (and on top of) testing code on a local web server (here we have MAMP for Apache\/PHP\/MySql Perl CGI) &#8230; all these Perl CGIs go through that level of testing first, way before they go to any real web server (would highly recommend this).<\/p>\n<p>Have been meaning for three tutorials now to mention the Apache Error Log (called \/Applications\/MAMP\/logs\/apache_error.log here on MAMP (will be different location for other web servers)) which can guide you through Perl CGI (or other brands of CGI) error issues.   This makes sense (as a place to look) because the web server (Apache) sits above the CGI code, which sits next to your HTML\/(PHP)\/Javascript\/CSS code, which, today, have the role of providing the HTML form whose action goes to Perl CGI after validation goes through Javascript (remember  <a target=_blank title='Javascript Form Validation Primer Tutorial' href='http:\/\/www.rjmprogramming.com.au\/wordpress\/?p=1431'>Javascript Form Validation Primer Tutorial<\/a>).   Have a look at a bit of what such a log looks like <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/Perl_CGI_Email-99of.jpg\" title='Look of Apache Error Log on local web server MAMP'>here<\/a>.<\/p>\n<p>Here is a <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/email_sender.html\" title='Click picture.'>live link<\/a> for today&#8217;s tutorial.<\/p>\n<p>With all Perl tutorials, like <i>Perl and CGI for the World Wide Web<\/i> by Elizabeth Castro &#8230; thanks heaps!<\/p>\n<p>Will leave you with some downloadable programming Perl source code you could call <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/email_sender.cgi_GETME\" title='email_sender.cgi'>email_sender.cgi<\/a> supervised by some HTML code containing the calling form called <a target=_blank href=\"http:\/\/www.rjmprogramming.com.au\/HTMLCSS\/email_sender.html_GETME\" title='email_sender.html'>email_sender.html<\/a><\/p>\n<p>Anything you want to ask?  No?  Well &#8230; we&#8217;ll be off then.   Bye for now, and hope you try the live link and enjoy the little mathematical tidbits in the emails.<\/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='#d7451' onclick='var dv=document.getElementById(\"d7451\"); dv.innerHTML = \"&lt;iframe width=670 height=600 src=\" + \"http:\/\/www.rjmprogramming.com.au\/wordpress\/?tag=Perl\" + \"&gt;&lt;\/iframe&gt;\"; dv.style.display = \"block\";'>this<\/a> too.<\/p>\n<div id='d7451' style='display: none; border-left: 2px solid green; border-top: 2px solid green;'><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Today we again venture into the world of CGI (Common Gateway Interface) on our Apache\/PHP\/MySql web server, this time to investigate using the Perl CGI to send emails via the Linux sendmail command. Found with the use of sendmail there &hellip; <a href=\"https:\/\/www.rjmprogramming.com.au\/ITblog\/perl-cgi-email-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,37],"tags":[195,196,380,503,652,707,885,916,997,1118,1319,1339,1411],"class_list":["post-7451","post","type-post","status-publish","format-standard","hentry","category-elearning","category-operating-system","category-tutorials","tag-centos","tag-cgi","tag-email","tag-gmail","tag-javascript","tag-linux","tag-operating-system-2","tag-perl","tag-programming","tag-sendmail","tag-tutorial","tag-unix","tag-web-server"],"_links":{"self":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7451"}],"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=7451"}],"version-history":[{"count":0,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/posts\/7451\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/media?parent=7451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/categories?post=7451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rjmprogramming.com.au\/ITblog\/wp-json\/wp\/v2\/tags?post=7451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}