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.

racknerd新上架“洛杉矶”VPS$29/年,3.8G内存/3核/58gSSD/5T流量

racknerd发表了2021年美国独立日的促销费用便宜的vps,两种便宜的美国vps位于洛杉矶multacom室,访问了1Gbps的带宽,采用了solusvm管理,硬盘是SSDraid10...近两年来,racknerd的声誉不断积累,服务器的稳定性和售后服务。官方网站:https://www.racknerd.com多种加密数字货币、信用卡、PayPal、支付宝、银联、webmoney,可以付...

A400互联(49元/月)洛杉矶CN2 GIA+BGP、1Gbps带宽,全场独服永久5折优惠

a400互联是一家成立于2020年商家,主营美国机房的产品,包括BGP线路、CN2 GIA线路的云服务器、独立服务器、高防服务器,接入线路优质,延迟低,稳定性高,额外也还有香港云服务器业务。当前,全场服务器5折,香港VPS7折,洛杉矶VPS5折,限时促销!A400互联官网:https://a400.net/优惠活动全场独服永久5折优惠(续费同价):0722香港VPS七折优惠:0711洛杉矶VPS五...

DiyVM:50元/月起-双核,2G内存,50G硬盘,香港/日本/洛杉矶机房

DiyVM是一家比较低调的国人主机商,成立于2009年,提供VPS主机和独立服务器租用等产品,其中VPS基于XEN(HVM)架构,数据中心包括香港沙田、美国洛杉矶和日本大阪等,CN2或者直连线路,支持异地备份与自定义镜像,可提供内网IP。本月商家最高提供5折优惠码,优惠后香港沙田CN2线路VPS最低2GB内存套餐每月仅50元起。香港(CN2)VPSCPU:2cores内存:2GB硬盘:50GB/R...

sendmail为你推荐
文件夹删不掉文件夹删除不了是什么原因?可以发外链的论坛可以发外链的论坛有那些?外网和内网内网和外网是什么意思啊??公章制作如何制作公章依赖注入依赖注入到底是为了解决什么问题的网站联盟网站联盟的运作流程硬盘人500G的硬盘容量是多少啊?免费免费建站我想建一个自己的免费网站,但不知道那里有..免费qq空间装扮有办法免费装扮QQ空间吗??mate8价格华为mate8什么时候会降价
网站空间租用 新加坡虚拟主机 免费二级域名注册 budgetvm 北京主机 ca4249 免费个人空间申请 全站静态化 秒杀预告 nerds 免费申请网站 华为云服务登录 双线asp空间 空间登录首页 lamp是什么意思 lamp架构 lamp兄弟连 godaddy空间 小夜博客 googlevoice 更多