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.
这两天Linode发布了十八周年的博文和邮件,回顾了过去取得的成绩和对未来的展望。作为一家运营18年的VPS主机商,Linode无疑是有一些可取之处的,商家提供基于KVM架构的VPS主机,支持随时删除(按小时计费),可选包括美国、英国、新加坡、日本、印度、加拿大、德国等全球十多个数据中心,所有机器提供高出入网带宽,最低仅$5/月($0.0075/小时)。This month marks Linod...
10gbiz怎么样?10gbiz在本站也多次分享过,是一家成立于2020的国人主机商家,主要销售VPS和独立服务器,机房目前有中国香港和美国洛杉矶、硅谷等地,线路都非常不错,香港为三网直连,电信走CN2,洛杉矶线路为三网回程CN2 GIA,10gbiz商家七月连续推出各种优惠活动,除了延续之前的VPS产品4折优惠,目前增加了美国硅谷独立服务器首月半价的活动,有需要的朋友可以看看。10gbiz优惠码...
优林怎么样?优林好不好?优林 是一家国人VPS主机商,成立于2016年,主营国内外服务器产品。云服务器基于hyper-v和kvm虚拟架构,国内速度还不错。今天优林给我们带来促销的是国内东北地区哈尔滨云服务器!全部是独享带宽!首月5折 续费5折续费!地区CPU内存硬盘带宽价格购买哈尔滨电信2核2G50G1M53元直达链接哈尔滨电信4核4G50G1M83元直达链接哈尔滨电信8核8G50G1M131元直...
sendmail为你推荐
google竞价排名哪些搜索引擎没有竞价排名?搜搜?谷歌?站长故事爱迪生发明电灯的故事简短湖南商标注册湖南商标注册怎么办理雅虎社区雅虎资讯在哪里提交中国论坛大全安徽论坛都有哪些?彩信中心联通手机的彩信中心如何设置?qq空间打扮如何打扮QQ空间?免费qq空间装扮有办法免费装扮QQ空间吗??linux虚拟机怎么样在Linux下安装虚拟机bluestack安卓模拟器bluestacks怎么用?
域名出售 日本私人vps 域名交易网 flashfxp怎么用 permitrootlogin 万网优惠券 网站木马检测工具 hktv in域名 美国独立日 网页提速 贵阳电信 阿里云邮箱登陆 带宽测试 e-mail 卡巴斯基免费下载 冰盾ddos防火墙 衡天主机 竞彩论坛空间 美国主机购买 更多