overlookedsendmail

sendmail  时间:2021-02-23  阅读:()
1599EmailSendmail,mailinglists,emailclients,andPOP/IMAP(remoteconnections)Thischaptershowsyouhowtosetupsendmail,setupsim-plemailinglistsforcustomers,clients,orgroupsofpeople,reviewsomeoftheemailclientsavailable,andsetupremoteconnectionsusingthePOP(PostOfceProtocol)andIMAP(InternetMessageAccessProtocol)mailstandards.
Email(electronicmail)wasoneoftherstmethodsforcommunicatingoverwhatisnowtheInternet.
Emailallowedshortmessagestorouteacrossvari-ousmachines.
Intheearlydays(1987),youoftenhadtomanuallyspecifyallthemachines(orhops)anemailmessagewouldhavetoroutethroughtogettotheendhost.
WithTCP/IPasthecommunicationmethod,thingsareabitsmarterinthatyoudon'tneedtoknowhowtogettotheendhost—aslongassomemachinealongthewayknowshowtoroutetheemailforyou.
Thetech-nicalnamefortheemailthatyougetontheInternetisknownasSimpleMailTransferProtocol(SMTP).
ThereareafewotherprotocolsthatworkwithSMTP,suchasPOPandIMAP,butwe'llgettothoselater.
YoucanndmoreinformationaboutSMTPinRFC821.
160Chapter9EmailTheprimaryprogramthatistheMailTransportAgent(orMTA)issend-mail.
Thereareothersavailable,butsendmailisprettymuchthestandardformostLinuxinstallations.
Youmayhaveseenthatreallythickbookwithabatonitthatgetsyouintothenitty-grittyofsendmail.
Itgetsreallynitty-gritty.
1Theupshotofallthisisthatyoudon'talwaysneedsendmailtosetupasimpleemailserver.
Theonethingyoushouldknowaboutsendmailisthis:Alwaysbesureyouhavethelatestversion.
Eachversionofsendmail,whilepatchingvariousbugs,seemstohaveasecurityproblemwithit.
SometimesitseemslikeyouneedtoupgradeyoursendmailsoftwaremoreoftenthantheLinuxkernel.
Enoughofthat.
Let'sgettothetypicalsendmailoptionsyou'llseeonstart-up.
MostLinuxinstallationshavesendmailkickinonbootup.
RedHat(beingSYSV-ish)hasan/etc/rc.
d/init.
d/sendmail.
initscriptthatrunsonstartup.
Aninstallationcouldstarttheactualcommandlikethis:echo-n"Startingsendmail:"daemonsendmail-bd-q1hechotouch/var/lock/subsys/sendmailAsyoucansee,thesendmailprogramstartswiththe-bdand-q1hoptions.
The-bdsigniesthatsendmailshouldstartupasadaemonandruninthebackground,waitingforconnections,muchthesamewaythataWebserverisalwaysrunning,waitingforaconnection.
The-q1hmeansthatsendmailshouldgothroughitsqueueatleastonceanhourandtrytosendanydatainitsqueue.
Thereareanumberofreasonswhyanemailmessagewouldbeheldinaqueue.
Forexample:Youhaveadialup-onlyconnectiontotheInternet,andyousendanotewhileyou'renotconnected.
Theremotehostisnotdialedin(samethinginreverse).
Theremotehostisdownforupgradesoritcrashed.
Thereisnoconnectiontotheremotehost(thenetworkisdown).
Inanyofthesecases,you'llwanttomakesurethatyouremailgetsthrough.
Leavingtheemailinsendmail'squeueallowsyoutodothis.
AmachinedirectlyconnectedtotheInternetoronaLANcanchangethisto1Ifyouhaveanythingtodowithsettingupsendmail,getthisbook.
161tenminutes(-q10m),sinceyou'remorelikelytobeconnectedtotheInternetallthetime.
Incaseyou'reinterestedinwhat'scurrentlyinthequeue,themailqcommandwilllistwhatsendmailhas.
Themailqprogramwillalsolistthereasonwhyanemailmessageisstuckinthequeue.
Ifthereisalotofemailinthequeue,youmayhaveanetworkorcongurationproblem.
YoucanverifythatsendmailisrunningbyconnectingtoTCPport25.
[markk@wayga~]#telnetlocalhost25Trying127.
0.
0.
1.
.
.
Connectedtolocalhost.
Escapecharacteris'^]'.
220wayga.
netESMTPSendmail8.
7.
6/8.
7.
3;Fri,18Apr199700:26:18-0400Asyoucansee,theconnectionworks,andthereisabitofinformationaboutthehostweconnectedto:statusnumber,hostname,typeofSMTP(ExtendedSMTP),theSendmailprogram(insteadofqmailorthelike)ver-sion8.
7.
6,andthecurrenttimeanddatethatthecomputerthinksitis.
Thecongurationoptionsforsendmailaretypicallylocatedin/etc/sendmail.
cf.
Examinetheleifyoulike,butdon'tchangeanythingunlessyouknowwhatyou'redoing!
Smallchangescanrenderyouremailsystemuseless.
Asalways,backuplesthatyouwanttoedit,justincase.
Afewoptionsyoumaywanttonote:OA—Cansetanotherlethatcontainsaliases.
We'llgetintothiswithmajordomo.
Mlocal—SpecieswhatprogramwillactastheMailDeliveryAgent(MDA).
Thiscanbesomethinglike/bin/mailor/usr/bin/proc-mail(we'llgettothislater,too!
).
DS—Containsapointertoa"smart"relayhost.
IfyouhaveaveryslowconnectiontotheInternetordon'thaveDNSsetup,youcanspecifyanothermachinetoacceptallyouremailanddeliveritforyou.
Fordial-uplinks,youonlyhavetosendtheemailonce,andamachinethatispermanentlyconnectedtotheInternetcanholditinitsqueue.
Cw—ThisoptionworksifyouhaveoneInternethostthathasmultiplenames(forexample,wayga.
netandratatosk.
org).
Thisentrywillallowyoutospecifywhichhostsyouwillreceiveemailas.
162Chapter9Email9.
1Usingm4FilesOneoptionthatmanyversionsofsendmailhasistheoptiontohaveyoursendmail.
cfleautomaticallygenerated.
Thiswillallowyoutokeepasmalllethathasmostoftheoptionsyouwishtouse.
Whenupgradingsendmail,youneedtorecompileonlysendmail.
cftohavethelatestupdatestothatle.
Them4macrolanguageisexcellentfordoingthis,andsourcesforvari-oustypesofsendmail.
cflesareincluded.
Ifyoudecidetousethem4les,besuretodownloadthesourcecodeforsendmail,astheRedHatdistributiondoesnotincludem4lesbydefault.
Them4processorisinstalledbydefault,however,andislocatedin/usr/bin.
9.
2YouHaveMail!
Onceemailhasarrivedatyoursystem,thereareafewthingsthathappentoitbeforeyouactuallygetalertedtonewemail.
First,sendmailcheckstoseeifyouhavea.
forwardleinyourhomedirectory.
Ifso,thensendmailwillforwardtheemailtowhateveraddressisspeciedinthe.
forwardle.
Ifyou'reusingprocmailandyouhavea.
procmailrcle,sendmailwillrunprocmailandfollowtherulesinit.
Afterthat,sendmailappendstheemailtoalecalled/var/spool/mail/,whereistheusername.
Thisledoesnotneedtobecreatedwhenmakinganewuser;sendmailwilltakecareofthatthersttimetheusergetsanemailmessage.
Creatingmailaliasesallowsincomingmailtogetroutedtoadifferentuserorprogram,evenifthereisnouseraccountwiththatnameonthesystem.
Thiswillhavealargerimpactoncewegettomanagingmailinglists.
Fornow,youmaywanttoexaminethe/etc/aliasesletoseewhataliasesarecur-rentlydened.
Thisisamethodofhavingamailaliasthatreallysendsthemailtosomeoneelse,oragroupofpeople.
Forexample,acommon/etc/aliaseslemaycontainthefollowing:MAILER-DAEMON:postmasterpostmaster:root#Generalredirectionsforpseudoaccounts.
bin:rootdaemon:rootgames:rootnobody:rootuucp:root9.
2YouHaveMail!
163#Well-knownaliases.
manager:rootoperator:root#Personwhoshouldgetroot'smailroot:markmfk:markbren:brendabdk:brendaYoucanseethatthereareanumberofaliaseslisted,mostofthempoint-ingtoroot.
Insomecases(binandnobody),theaccountsexist,butnooneshouldeverlogintothoseaccounts.
Inthiscase,anyemailthatgetssenttobinordaemonmerelygetsforwardedtoroot.
Also,notethatpostmasterissettoroot;inmostsituations,thepersonwhoadministersthemailalsoadministerstherestofthesystem.
TheMAILER-DAEMONismostlyformailerrors.
Theseerrorsgetsenttorootaswell.
Lateron,youseeafewuseraliases.
Thesealiasesaresetupsothatanyonesendingemailtomfk@wayga.
netwillgoautomaticallyintothemarkaccount.
Thereisnomfkaccount,butpeoplecansendemailtothataddress.
Thesameistrueofanyonesendingemailtobren@wayga.
netorbdk@wayga.
net.
Asmallbusinesscouldhaveemailaliasesofmark.
komar-inski,mfk,m.
komarinski,markk,mark.
k,andanyotheruniquepermuta-tionofanameincaseoutsidecustomersforgetanemailaddress.
Itissomethingthat'softenoverlooked,butitisveryimportanttokeepintouchwithcustomers.
Oncethemailisdeliveredtothecorrectaccount,aprocesscalledcomsatruns;comsatiswhatactuallytellstheshellthatyouhavenewmail.
Oncetheshellgetsthatinformation,itmaynotifyyouofit.
Thebiff2programtellsyouifyou'llreceivenotication,anditalsoletsyouturnitonoroff.
Theyoptiontobiffwillturnmailpromptingon,andnwillturnitoff.
TherearealsoXversionsofbifftogiveyougraphicalnoticationthatemailhasarrived.
Nowthatyou'vereceivedanemailmessage,howareyougoingtoreaditThisisthejoboftheMUA,orMailUserAgent.
Thisistheonlyareatheend-userisgoingtointeractwithdirectly.
Therearedozensofprogramsavailablefromthelow-feature(mail)tothehigh-feature,full-screen(elm,pine,mutt)tothegraphical(Netscape).
2WhynamethecommandbiffTurnsoutthat'sthenameoftheauthor'sdog.
UnderUNIX,ifyouwriteit,younameit.
164Chapter9EmailWhatisusedformailreadingisprettymuchuptotheuser.
Forexample,manypeoplepreferpineoverelm.
Ifyouplanonhavingmanyusers,it'sbesttoinstallafewMUAsasidefrom/bin/mail.
RedHat'sinstallationprovidesanumberofdifferentMUAstosuiteveryones'needs.
EachMUAhasadvan-tages.
9.
3MIMEWhenSMTPwasrstdesigned,itwouldhandleonly7-bit(plainASCII)data.
Hencethe"Simple"intheprotocolname.
WiththingslikeJPEGimages,soundles,applicationdata,andcompressedlestobesentthroughemail,therehadtobesomewayofsendingbinary(8-bit)datathrougha7-bitstream.
Therstmethodofhandlingthiswasviatheuuencodeprogram.
Thisprogramwouldturntwobytesof8-bitdataintothreebytesof7-bitdata.
Thelesizewastwo-thirdslarger,butitwouldnowsqueezethroughthe7-bitpaththatSMTPprovided.
Anotherprobleminadditiontothelesizewasthattheremotesidehadtodecodethedata(uudecode).
Thisturnedintoatediousprocedure,thesenderencodingthedataandmanuallyinclud-ingitinamailleandthereceivertryingtostripoutallthemailheaders,text,andsignaturestogettotheuuencodeleandthendecodeit.
Intheearly1990s,theMultipurposeInternetMailExtension(MIME)wasdevelopedtodothis,anditisusedtodayontheWebfordeterminingletypes.
MIMEencodedeachdatatypesuchthatanyMIME-capablemailreaderwouldunderstandwhatkindofdatawasinthemessage.
Oncealetypewasdetected,eachindividualusercouldhaveale(.
mailcap)thatwouldlistwhatletypesyouknewabout,andwhatapplicationtorunonceyoufoundthatletype.
Forexample,ifaJPEGimageweresent,thereceiv-ingsidemightstartupthexvprogramanddisplaytheimageinanXwindow.
AnotherusermighthaveitsetupsotheimagewasconvertedintoPostScriptandsentdirectlytotheprinter.
3Mostmailerstodayhavetheabilitytohan-dleMIMEmail,andthereshouldbelittletonointeractionthatyouasanadministratorhavetoworryabout.
3Thisisagoodexampleof"theUNIXway"—there'smorethanonewaytodoanything.
9.
4The.
forwardFile1659.
4The.
forwardFileWhenmailcomesin,the.
forwardleischecked.
Ifitexists,theemailissenttotheaddresslistedinthele.
ThisishelpfulifyouhavemultipleaccountsontheInternetandwantalltheemailtocometoonelocation.
Anexampleof.
forwardshowsanotherfeatureofthele—insteadofanemailaddress,youcanhaveacommand.
Thevacationprogram,whichisn'tavail-ableinRedHat(butisontheCD-ROM),allowsyoutoputaprograminthe.
forwardle.
Eachtimeemailcomesin,theprogramisrun.
Thevacationprogramstorestheemailandthensendsacustommessagebacktotheemailsender,notifyingthemthatyou'reonvacation(oroutoftown,outoftheofce,outofyourmind,etc.
).
Thesenderthenknowsthattheemailgotthrough.
ProcmailIfprocmailisinstalledastheMailDeliveryAgent(MDA)onyoursystem(checktheMlocalentryinyoursendmail.
cftondout),youcanimmedi-atelyuseittolterallyourincomingmail.
Ifnot,youcanputareferencetoprocmailinyour.
forwardtoruneachtimenewmailarrives.
Procmailisusedtoprocessmailasitcomesin.
Thiscanincludeputtingallemailfromthe"Plan9MUSHAdvisoryCommittee"inonemailboxseparatefromevery-thingelse,orlteringallthatannoyingemailyougetfrombillg@microsoft.
combysendingitto/dev/null.
4Ifprocmailissetuptobethedefaultlocalmailhandler,settingproc-mailupforuseiseasy.
Createa.
procmailrcleandstartaddingrulesforprocmailtolter.
Ifprocmailisnotyourlocalmailhandler,youhavethreeoptions:1.
Makeprocmailthelocalmailhandler(themanpagehasthesuggestedchangesyoucanmaketothe/etc/sendmail.
cffile).
Ifyou're4Anythingsentto/dev/nullisimmediatelydiscarded.
Thisiscalledthe"bitbucket.
"ThankstothefactthatLinuxisa32-bitOS,itsbitbucketisoneofthefastestaround.
166Chapter9Emailusingm4congurationles,addFEATURE(local_procmail)toyourle.
2.
Runprocmailperiodically,orusecrontolteroutanexistingmailbox.
Thisstillallowsyoutouse.
forward(intheeventofavacationandthelike),butthemailisnotalwayssortedandyouwillhavetowait.
3.
Putareferencetoprocmailinyour.
forwardle.
Notethatthiswon'tletyouforwardallthateasily.
Inthe.
forwardle,putalineinthatlookslikethefollowing:"|IFS=''&&exec/usr/local/bin/procmail-f-||exit75#YOUR_USERNAME"Asyoucanguess,option1isthebest,asitrequirestheleastamountofeffortoneveryone'spart.
5Here'sacopyofasample.
procmailrcle:PATH=/bin:/usr/bin:/usr/binMAILDIR=$HOME/Mail#you'dbettermakesureitexistsDEFAULT=$MAILDIR/mbox#completelyoptionalLOGFILE=$MAILDIR/from#recommended:0:*^From.
*markfrom_me:0*^Subject:.
*Flame/dev/nullTherearethreesectionstomatchingalineandperformingsomeactiononit,alsocalledarecipe.
Arecipestartswithalinethathasatleast:0.
Afterthe:0,youcanincludesomeags(forexample,Hwillscanonlytheheaders).
Patternmatchingisdoneforanylinesthatstartwithanasterisk(*).
Therestofthelineissenttoegrep6literally.
Ifallofthelinesmatch(thelinesareANDedtogether),thentheappropriateactionistaken.
Ifnot,itmovesontothenextrecipe.
Therecanbeonlyoneactionline,andthisistheonethatdoesnotstartwithan*or:.
Anactionstartingwith!
willforwardtheprogramtothespec-5Exceptthesystemadministrator,whohastoinstallthesoftwareandmakesurethatsendmailisn'tbusted.
Ohwait.
That'syou.
Scratchthat.
6egrep=extendedgrep,andthesyntaxisnotexactlythesameaswithplaingrep.
9.
5MailingLists167ieduser.
Anactionstartingwith|willstartashellandpipetheemailtothatprogramforprocessing.
Anythingelsewillbeassumedtobealenametoappend(orcreateifitdoesn'talreadyexist).
ThesetwoexamplesshowthatallmailthathasaFromlineandendsinmark(whichwillbeanyemailsentbyme)willbeputinthe~/Mail/from_memailbox.
Thesecondexampleshowsthatallemailthatstartswiththeword"Subject"andendsin"Flame"willbesentto/dev/null(thebitbucket).
Thethingtoknowifyoujustwanttodeletemailout-of-handisthatyouhavetobeabsolutelysurethatyourlogiciscorrect.
Forexample,ifyoudeleteallmailthathastheword"Flame"init,thenyoucouldpotentiallylosemessageswithasubjectsuchas"Flamebroiledburgersfreeuntil10AM.
"OK,soit'sapoorexample.
Youmaywanttostoremailyouwanttodeleteforawhileandthenexamineitjusttobesureyoudon'tloseanythingimportant.
9.
5MailingListsMailinglistsallowlargergroupsofpeopletocommunicateviaemail.
Inmanycases,itispreferabletousingUSENETsincemailinglistsdonotneedapprovalfromanyoneotherthantheadministratortobecreated.
AnyonewithamachineconnectedtotheInternetcancreateamailinglistonanysubject.
Gettingmemberstosubscribetoitisadifferentissue,how-ever.
Mailinglistscancontrolwhosubscribes.
Themailinglistadministratorcanmakeitsoanyonecansubscribe,orhe/shecanmakeitsothattheadminis-tratoristheonlyonewhocanaddnewmemberstothemailinglist.
Theadministratorcanalsoremoveoffendingmembersifaproblemarises.
Mailinglistscancontrolcontent.
Thisisn'tasbadasitsounds,sinceitisthealternativetotheanarchythatisUSENET.
Theadministratorcansetthelistuptobeopenandprovideahealthydiscussionarea(suchasfordevelop-ersworkingonapieceofsoftware).
Alternatively,thelistcanbesetupsuchthattheadministratorhastoapproveeachpieceofemailthatgetssenttothelist,likemoderatedUSENETgroups.
Moderatedlistsaregoodfornewsreleases,humorlists,oranyotherlistwheretheamountofdiscussionislow.
MajordomoThebestmailinglistprograminusehastobemajordomo.
Majordomopro-videsallthefeatureslistedabove,plusaddsafewotherfeatures,suchas168Chapter9Emailsendingoutregulardigests,orarchivingforfutureuse.
We'llgetbacktotheselateron.
Therstthingthatneedstobesetupismajordomoitself,ifit'snotalreadyinstalled.
ThesourceforitislocatedontheCD-ROM.
YouneedtohavePerl5installedonthesystem(aswellasGCC,ofcourse)touseit.
First,createamajordomouser.
Giventheeight-characterlimitationsofLinux'susernames,theusernamewillhavetobeshortenedtomajordom.
Thanksto/etc/aliases,nooneeverhastoknowthis.
Youshouldalsocreateahomedirec-toryforthemajordomuser.
Thiscanbe/home/majordomifyoulike,or/usr/local/majordomifyouprefer,oranywhereyouhavespace.
Sutomajordom,7copythemajordom1.
94.
1.
tar.
gzletothehomedirectory,anduncompress/untarthele.
Makeanykindsofmodicationstothemajordomo.
cfle;thenjustusethemakecommandtocreateit.
Onceinstalled(whichshouldbeinthemajordomohomedirectory),youneedtomakeonlyonechangetothe/etc/sendmail.
cfle.
YoushouldalreadyhaveoneOA(orOaliasle)entrylisted.
Underneaththat,putinthefollow-ing:8OA/home/majordomo/majordomo.
aliasesThissetsupanadditionalletohandlealiases.
Italsomakesiteasierforthemajordomoadministratortoaddnewmailinglists,andthatpersondoesnotneedrootaccesstomodifythelists.
Now,ontocreatingtheliststhemselves.
Let'screatea(ctional)listcalledgastro.
Itwillbeanopenlistforsharingrecipes,soanyonecanjoin,andanyonecanpostanotetothegroup.
Inthe~majordom/majordomo.
aliasesle(we'llcallitthealiaslefromnowon,incaseyouchosetouse/etc/aliasesinstead),addthefollowing:gastro:"|/home/majordom/wrapperresend-lgastrogastro-list"gastro-list::include:/home/majordom/lists/gastroowner-gastro:markgastro-owner:markgastro-request:"|/home/majordom/wrappermajordomo-lgastro"gastro-approval:mark7Yousetupapasswordforthemajordomuser,right8Notethatthisisabitofasecurityrisk,asrootshouldreallybetheonlypersonwhocancreatenewaliases.
Ifyouwant,leavethisstatementoutanduse/etc/aliasesinsteadofthemajordomo.
aliasesfile.
9.
6Qmail:AnAlternativetoSendmail169Thissetsupthebasics.
Thelistitselfwillbegastro@host,theownerwillbemark,andanyrequeststojointhelistwillbesenttomajordomoaswell.
Normally,userswouldsendemailtomajordomo@hosttosubscribe,butdif-ferentmailinglistsoftwareworksindifferentways.
Oncethealiasesaresetup,youcaninitializethelistsusing:echo"configgastrogastro.
admin"|mailmajordomoandthelistswillhavesomedefaultcongurationsputin.
Ifyouchoosetochangethedefaults(andyoushould!
),editthe~majordom/lists/gas-tro.
configle.
Thishasallthecongurationsettingsfortheparticularlist.
Nowthatyourmailinglistissetup,youshouldbeabletoemailtothelistbyjustsendingmailtogastro@host,andtheemailwillbesenttoallthesubscribersofthegastrolist.
Thereareanumberofextrafeaturesthatmajordomohas,andyoushouldcheckouttheWebsiteformoreinformationandtogetthelatestupdates.
9.
6Qmail:AnAlternativetoSendmailOneofthebetterknownreplacementsforsendmailiscalledqmail.
Therearetworeasonsforitspopularity:easeofuseandsecurity.
Thisdoesn'tmeanthatqmailisbestforeveryone,sincethereareanumberofchangesthatyoursys-temhastogothroughtouseqmail.
It'salsonotperfectinalargeinstallation(yet)becauseofsomeofthewaysthatsendmailandqmaildiffer.
Thecongu-rationforqmailismuchsimplerthansendmail,butitdoesn'tofferthe"Swissarmyknife"ofMailTransportAgents(MTAs)thatmanyexpecttosee.
Here'safewofthewaysinwhichqmailandsendmaildifferinmethodology:Maillelocation—Sendmailpreferstouse/usr/spool/mail/userasalocationforincomingmail.
Qmailpreferstouse~user/Mailboxasalocationforstoringmailles.
Thisisfortworeasons.
First,puttingthemailintheuser'shomedirectoryprovidesforbetterquotacheckingandpreventsoverllingacentrallocation.
Second,therearefewersecurityproblemssincethereisn'tacentrallocationtostoreles.
Permissions—Sendmailrunsalmostalwaysasroot,orwithrootprivi-leges,towritelesandsoforth.
Qmailrunsasrootonlywhennecessaryandotherwiserunsasaqmailuser,whichhasnospecialpermissions.
Mailinglistintegration—Sendmailhasexternalprogramstocreateanditadministersmailinglists(majordomoandlistproc).
Qmailsupportsa170Chapter9Emailmethodwhereindividualuserscanhavetheirownmailinglistsandadministerthemthemselveswithnoextraaccountsorpermissions.
Size—SendmailisamonolithicMTA,whereeverythingisdoneintheprogramitself.
Qmailhasanumberofsmallerprogramstohandleeachaspectofmailreceipt,delivery,sending,andsoforth.
InstallingQmailYoucandownloadqmailineitherRPMformatorsourcecode(alsocalledatarball,duetothefactit'sintarformat).
Bothlescanbefoundathttp://www.
qmail.
org/.
IfyoudownloadinRPMformat,besuretoremovethesendmailRPMfromyoursystemtoavoidconicts.
TheRPMisinsourcefor-mat,buthandlesmanyofthefunctionsofbuildingandinstallingqmail,andaddingtheusersandsettingupinitializationscriptsforusewithRedHat.
Afteryougettheqmail-1.
03.
tar.
gzle,untaranduncompressthele.
Thiswillcreateaqmail-1.
03directorywiththesourcecodeinit.
ReviewtheINSTALLlesoyouknowwhatthefullinstallprocedureis.
Thisproce-dureallowsyoutobuildandinstallqmailwithoutaffectingthesendmailyouprobablyalreadyhaveinstalleduntilyou'resatisedthatqmailisworkingcorrectly.
Qmailresidesinthe/var/qmaildirectory,soyou'llneedtocreatethatdirectoryandrememberthatsoyoucanmonitorthatdirectory.
Next,you'llneedtocreateusersforqmailtouse.
Sincesecurityisabigcomponentofqmail,thesenewuserswillneedtobecreatedtoseparateqmailfromtherootuserandregularusers.
Nowforthesimplepart.
Entermaketobuildqmail.
Thecompileshouldtakeafewminutestocomplete,andyou'llbereadyfortheinstallationandtesting.
Thebiggestproblemyoumayrunacrossisthefactthatyourhomedirectoryand.
qmaillescannotbegroup-orworld-writable.
Thiswillshowupinthelogsassomethinglike:Feb816:50:00waygaqmail:886974600.
032889delivery10:deferral:Uh-oh:_.
qmail_file_is_writable.
_(#4.
7.
0)/Inthisevent,justndthe.
qmailleit'sreferringtoandchangetheper-missions.
You'llalsowanttocheckforothercopiesofthesendmailprogramoatingaroundthelesystem(likein/usr/sbin/,forexample),andchangethosetouseqmail.
Alsowhiletesting,rememberthatmailisnolongerbeingdeliveredto/usr/spool/mail/user,butto~user/Mailbox.
Oncethetestingandcongurationaredone(theINSTALLleisprettythoroughonthis),youcanthentellyourusersaboutthechangesandstartusingqmail.
9.
6Qmail:AnAlternativetoSendmail171Afewnotesyoushouldknowofifyou'reconsideringchangingMTAs:Ifyou'reupgradingorchangingsoftwaretosomethingyou'renotusedto,alwaysuseastagingmachine.
ThereareinstructionsintheFAQleonhowtoupgradeslowlyfromsendmailtoqmailwithaminimumoffussandtrouble.
Thisupgradepathallowsyoutousebothqmailandsendmailuntilyougetthebugsworkedoutandmovetoqmailcom-pletely.
Youmaynotwanttoputqmailonaconnectionthatgoesdownfre-quently.
Oneofthefeaturesofqmailisthatitcontinuallytriestodelivermail.
IftheInternetlinkgoesdownoften,youcouldbeinasituationwhereqmailistryingtodeliverlotsofmailatthesametime.
Ifyouhaveadialuplink,itmightbeworthittocheckouttheserialmailprogram,whichisdesignedtosendoutemailondemand(i.
e.
,whenthelinkisup).
Inadditiontothe/usr/spool/maildirectorychanging,the.
forwardleisignoredinfavorofthe.
qmaille.
The.
qmaillehasanumberoffeaturesthatcan'tbeputin.
forward,butprogramsthatoperateon.
forwardwon'tworkanymore.
Onceqmailisconguredandworkingproperly,you'llneedtomakesurethatyoucandelivermailtoeachuser(checktheirmailleandthesyslogoutputin/var/logtomakesuremailisbeingdeliveredproperly).
Thereareafewthingsthatyouwillnoticeonceqmailisinstalled.
Forthebenetofyourusers,youshouldwarnthemaheadoftime.
Aspreviouslymentioned,mailnowgetsstoredin~user/Mailboxinsteadof/usr/spool/mail/user.
You'llneedtomakesurethattheMAILenvironmentvariableischanged(see/etc/profile).
Therearetwoproblemswiththe/usr/spool/mailapproachtodeliveringmail.
First,it'sasecurityrisk.
Second,thewaysendmaildoeslocalmaildeliv-eryispronetolosingmailifthemaildirectoryismountedviaNFSoriftheservergoesdownwhilewritingemail.
The"Mailbox"formatinqmailmakessuretheemailiswrittentothediskbeforeitreportssuc-cessbacktothemainqmailprogram.
Ifthereisalockingproblemorthemachinegoesdownwhileamessageisbeingdelivered,itwillgetdeliveredwhenthemachinerestartsorthelockgoesaway.
Qmaildoesnotlookinthe.
forwardleanymoreforforwardingemailtootherusers.
Thereplacementle,.
qmail,handlesthis.
Thenicethingaboutthisisitallowsyouasausertocreateyourownsimplemail-172Chapter9Emailinglists.
Forexample,ifyouwantedtocreateasimplemailinglistrelatedtothisbook,youcouldcreatea.
qmail-linuxleinyourhomedirectory.
Thatlethenwouldgetalistofthepeopleyouwantedtobeonthelist.
Oncethiswasdone,anyemailsenttoyouraddresswouldgetsenttotheentirelist.
Youcouldevenhavea.
qmail-defaulttocatchallenry-*emailthatcamein.
Notethatthisisn'taveryfull-fea-turedmailinglistsystemasitdoesn'thandleautomaticsubscribesorunsubscribes.
Thisiswhereezmlmcomesin(seenextsection).
Qmailalsodoesnotuse/etc/aliasesatall.
Thereisaglobalwayofsettingupemailaliases,whichisabiteasiertouse.
Thealiasuserisusedbyqmailtohandleaddressesthatdon'texist.
Forexample,youcouldhave~alias/.
qmail-markkcontaintheline:enry@wayga.
nettoforwardemailthatcomesinformarkk@wayga.
nettoenry@wayga.
net.
Acommonuseofthisissettinguppostmaster,abuse,orrootaliases.
Therootuserdoesnotreceiveemail.
Duetothenumberofsecurityproblemsthiscouldcause,itwasdeterminedthatrootshouldbealiasedtosomeoneelse(liketheactualadministratorofthemachine).
Thismakescrackingarootaccountmuchharder.
EzmlmTheezmlmpackageallowsforeasymailinglistsetup.
Ithasallthefunction-alitycommonlyneededinmailinglistapplications:automaticsubscribe/unsubscribe,moderatedlists,anddigestcreation(handledbyezmlm-idx).
Unlikemanyothermailinglistapplications,ezmlmiscommand-based—thereshouldbenoneedforthemailinglistadministratortoeditles.
Anotherfeatureofezmlm(andqmail)isthatmailinglistcreationandadmin-istrationdonotrequireaccesstotherootaccount.
Bydefault,manyoftheezmlmprogramsgetinstalledin/usr/local/bin/ezmlm.
TheinstallinstructionsareintheINSTALLle(locatedintheezmlm-0.
53directory)andarestraightforward.
Onceinstalledandtested,userscancreatetheirownmailinglistswiththefollowingcommands:ezmlm-make~/list~/.
qmail-listuser-listhostThiscreatesthemailinglist.
Themailinglistitselfiscontainedin~/list.
Thismailinglistisnotmoderatedinthatanyonecansubscribeandunsub-9.
6Qmail:AnAlternativetoSendmail173scribe.
Ifyouwantaprivatemailinglistwhereonlythemoderatorcanaddandremovemembers,youcanaddthe-Poption.
Oncethemailinglistiscreated,youcanjustremove~/list/publictocreateamoderatedlistorcreatetheletocreateapubliclist:ezmlm-sub~/listemailThissubscribesemailtolist.
Thenewmemberissubscribedtothelist.
ezmlm-unsub~/listemailThisunsubscribesemailfromlist.
ezmlm-list~/listThisliststhemembersoflist.
Oncealistiscreated,theuser-list-subscribeanduser-list-unsubscribeemailaddressesarecreatedforuserstosubscribeandunsub-scribe.
Ifthemailinglistismoderated,thesemailaddresseswillnotworkandthemoderatorwillhavetomanuallyaddnewmembers.
Anextensiontoezmlm,ezmlm-idx,providesformoremoderationandarchiving.
EzmlmFilesOnceamailinglistiscreated,you'llndthefollowinglesinthedirectory:Archive/Containsanarchiveofthemailinglist.
Mes-sagesarenumberedfrom1on.
Ifthearchivedleexists,nomessageswillbearchived.
ArchivedIfthisleexists,ezmlmwillarchivemessages.
HeaderaddContainsalistofheadersthatwillbeaddedtoemailsentbyezmlm.
HeaderremoveHasalistofheadersthatwillberemovedfromemailthatgetssentoutbyezmlm.
KeyThislehassomerandombinarydatatopre-ventforgingsubscriptionrequests.
NumContainsthenumberofmessagessentsofar.
174Chapter9Email9.
7RemoteEmail(POPandIMAP)POP(PostOfceProtocol)andIMAP(InternetMessageAccessProtocol)aretwoofthestandardsforreceivingemailfromaremotemachine.
ThebestexampleofremoteemailuseisinanofcesituationwherethereisaLinuxserverandWindows(orMac,orotherUNIX)clientsalsorunningonthenet-work.
Theclientscanreceivetheiremailinanumberofways(Eudora,Netscape,PC-Pine,etc.
)andstillhaveonecentralmailserver.
Eachprotocolhasstrengths,weaknesses,andassortedMailUserAgents(MUAs)thatsupportthem.
BothareavailableinaRedHatinstallsetupreadytorun.
AuthenticationofemailisdonebythesamePAMschemethatisusedtologin.
OneoftheadvantagesofusingPOPorIMAPisthatlittleusersetupisrequired.
Youcantypicallyinstallandrunclientsoftwarewith-outanytrouble.
POPPOP(PostOfceProtocol,denedinRFCs937and1225)wasoneoftherstmethodsforretrievingandsendingemailto/fromaremotemachine.
Theprotocolisrathersimple.
Youcanget,list,anddeletemail.
That'saboutit.
Thegoodthingaboutit,though,isthatyoucanpickupyouremailattheofcefromhome.
ThedownsidetoPOPisthattheemailontheserverisoftendeletedonceitgetssenttoyou.
9So,whileyoucangetyouremailfromworktohome,youthenhavetosendtheemailbackfromhometowork,orelseyouwon'thaveanyemailatwork.
Netscape,Outlook,andmostPC-basedInternetemailprogramshandlePOP.
PublicIfthisexists,userscansubscribeandunsub-scribewithoutthehelpofamoderator.
Ifitdoesn'texist,onlythemoderatorcanaddorremoveusers.
TextDirectorycontaininglesthatezmlmwillsendbackasadministrativemessages.
Youcanchangetheselesifyouwant.
9Tobefair,thisisaproblemwiththeapplicationsthatuseit,nottheprotocolitself.
POPcanbesetuptoleaveemailontheserver,whichcanfilltheserverupveryquickly.
9.
7RemoteEmail(POPandIMAP)175ThePOPserver(popper)isincludedinatypicalRedHatdistributionaspartoftheimap-4.
5RPM.
Touseit,conguretheclientsoftwaresothattheservermatchestheLinuxbox.
Theusernameandpasswordarethesameasin/etc/passwd.
Rememberthatanyemaildownloadedgetsstoredonthelocalmachine,somakesurethatuserdrivesarebackedupregularly.
OneoptiontolookatistheDon'tdeletefromserveroption,whichmightbenameddifferentlyonsomeclients.
Thisoptionleavestheemailontheserverafterdelivery.
Ifyouhavetwolocationswhereyouwanttoreadyouremailfrom(workandhome,forexample),youcanleavethisoptionoffontheofceemailsystem,andturnitonathome.
Thisway,allyouremailgetsdownloadedatwork,andyoucanonlygetnewemailfromhome.
IMAPisamuchbettersolutiontothisproblem.
IMAPIMAP(RFC2060)wascreatedtohandlesomeofthedecienciesofPOP.
IMAPisdesignedtobeaclient/serversetup,wheretheserverkeepsthemailuntiltheclientrequeststhatitbedeleted.
InPOP,alltheemailisdown-loadedatonce,whichisabitofaproblemforlargemessagesoverslowlinks.
IMAPallowsfordownloadingonlythebodyofamessagewhenitisrequired,allowingyoutoquicklydownloadheaderinformationandthenreadonlythemessagesyouwanttoread.
Emailcanbestoredindifferentles(oftencalledfolders)toallowyoutoorganizeyouremaileasier.
Thesefoldersremainontheserversideandcanbeaccessedbytheclientsoftwareatanytime.
AnotherbigfeatureofIMAPisdisconnectedmode,sometimescalledofinemode.
Iftheclientsupportsit,youcanhavetheclientdownloadoneormorefolderstoyourlocalmachine,usuallybyselectinganoptioncalledgooffline,downloadfolders,orofflinemode.
Youcanthenread,modify,delete,reply,andsoonwithoutbeingconnectedtoanetwork.
Whenyoureturntoyournetwork,youcanreturntoonlinemodeandsynchronizetheclientandserver.
AlistofclientsandtheirsupportforIMAPcanbefoundattheofcialIMAPhomepage,http://www.
imap.
org.
BothNetscapeCommunicatorandMSOutlooksupportIMAPandofinemode.
TheIMAPserverisincludedwithRedHatintheimap-4.
5RPM,andisconguredtogetlesfrom/var/spool/mail.
Tocongureitforusewithqmail,you'llneedtorecompiletheserver.
ClientsetupisaboutthesameasforPOP;settheservernameandtheusername/password.
Oneoptionthatyoumaywanttolookatistheserverdirectoryoption.
Thisoptiontellstheclientwhatdirectoryontheservercontainsthemailfolders(notthemboxornewmail–that'shard-codedontheserver).
Bydefault,thisistheuser's176Chapter9Emailhomedirectory,andifauserdoesnotstoreotherlesinthatdirectory,you'reokay.
However,ifyoushareuserhomedirectoriesviaSambaorNFS,you'llwanttochangetheserverdirectorytosomethinglike~user/Mail.
Thedownsidetothisisthatyouhavetosetiteachtimeyouconguresome-oneforIMAP.
Thebenetisthatyouruserswon'tconfusetheiremailwiththeirregularles.
Bydefault,mbox(mailthatwasreadinandnotputinanothermailfolder)isstoredin~user/mbox,whichisactuallythesameleusedbytheUNIXmailprogram.
Newmailischeckedforin/var/spool/mail.
Ifyouneedtochangethis,you'llhavetorecompilethesoftware.
Theeasywaytodothisistogetthe.
src.
rpmlefromtheRedHatFTPsiteorsourceCD-ROMandcompileit.
YoucanndoutmoreaboutinstallingandcompilingsourceRPMlesintheRPMchapter.
9.
8SummarySendmailisthedefaultwayofsendingemail.
Youmightbenetfromusingqmail.
MIMEallowsyoutoemailbinarydatafromonepersontoanother.
POPandIMAPallowyoutogetyouremailfromremotelocations.

美国高防云服务器 1核 1G 26元/月 香港/日本站群服务器 E5 16G 1600元/月 触摸云

触摸云国内IDC/ISP资质齐全商家,与香港公司联合运营, 已超8年运营 。本次为大家带来的是双12特惠活动,美国高防|美国大宽带买就可申请配置升档一级[CPU内存宽带流量选一]升档方式:CPU内存宽带流量任选其一,工单申请免费升级一档珠海触摸云科技有限公司官方网站:https://cmzi.com/可新购免费升档配置套餐:地区CPU内存带宽数据盘价格购买地址美国高防 1核 1G10M20G 26...

bgpto:独立服务器夏季促销,日本机器6.5折、新加坡7.5折,20M带宽,低至$93/月

bgp.to对日本机房、新加坡机房的独立服务器在搞特价促销,日本独立服务器低至6.5折优惠,新加坡独立服务器低至7.5折优惠,所有优惠都是循环的,终身不涨价。服务器不限制流量,支持升级带宽,免费支持Linux和Windows server中文版(还包括Windows 10). 特色:自动部署,无需人工干预,用户可以在后台自己重装系统、重启、关机等操作!官方网站:https://www.bgp.to...

华纳云不限流量¥324/年,香港双向CN2(GIA)云服务器/1核1G/50G存储/2Mbps

华纳云(HNCloud Limited)是一家专业的全球数据中心基础服务提供商,总部在香港,隶属于香港联合通讯国际有限公司,拥有香港政府颁发的商业登记证明,保证用户的安全性和合规性。 华纳云是APNIC 和 ARIN 会员单位。主要提供香港和美国机房的VPS云服务器和独立服务器。商家支持支付宝、网银、Paypal付款。华纳云主要面向国内用户群,所以线路质量还是不错的,客户使用体验总体反响还是比较好...

sendmail为你推荐
根目录什么叫固件?什么叫根目录?u盘无法读取U盘无法识别是怎么回事google竞价排名谷歌SEO与谷歌竞价的区别和联系万网核心代理万网代理商?中国万网认证核心分销商?中国论坛大全有谁知道国内人气最高的论坛排行榜?pwpw域名的技巧arm开发板单片机开发板与ARM开发板有什么不同?苹果5怎么越狱苹果5怎么越狱开机滚动条谁会调开机的滚动条lockdowndios8.1能用gpp3to2吗?型号A1429
免费网站空间申请 fc2新域名 传奇服务器租用 深圳域名空间 国外免费vps vps代购 域名备案网站 域名备案只选云聚达 备案域名出售 便宜域名 cloudstack sub-process 本网站在美国维护 gspeed 韩国名字大全 如何用qq邮箱发邮件 如何注册阿里云邮箱 Updog 安徽双线服务器 空间购买 更多