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.

AkkoCloud(60元/月 ),英国伦敦CN2 1核 768 MB 内存 10 GB SSD 硬盘 600GB 流量 英国伦敦CN2 1核  1.5G  300Mbps

官方网站:https://www.akkocloud.com/AkkoCloud新品英国伦敦CN2 GIA已上线三网回程CN2 GIA 国内速度优秀.电信去程CN2 GIALooking Glass:http://lonlg.akkocloud.com/Speedtest:http://lonlg.akkocloud.com/speedtest/新品上线刚好碰上国庆节 特此放上国庆专属九折循环优惠...

Dataideas:$1.5/月KVM-1GB/10G SSD/无限流量/休斯顿(德州)_主机域名

Dataideas是一家2019年成立的国外VPS主机商,提供基于KVM架构的VPS主机,数据中心在美国得克萨斯州休斯敦,主机分为三个系列:AMD Ryzen系列、Intel Xeon系列、大硬盘系列,同时每个系列又分为共享CPU和独立CPU系列,最低每月1.5美元起。不过需要注意,这家没有主页,你直接访问根域名是空白页的,还好他们的所有套餐支持月付,相对风险较低。下面以Intel Xeon系列共...

美国多IP站群VPS商家选择考虑因素和可选商家推荐

如今我们很多朋友做网站都比较多的采用站群模式,但是用站群模式我们很多人都知道要拆分到不同IP段。比如我们会选择不同的服务商,不同的机房,至少和我们每个服务器的IP地址差异化。于是,我们很多朋友会选择美国多IP站群VPS商家的产品。美国站群VPS主机商和我们普通的云服务器、VPS还是有区别的,比如站群服务器的IP分布情况,配置技术难度,以及我们成本是比普通的高,商家选择要靠谱的。我们在选择美国多IP...

sendmail为你推荐
免费制作qq空间怎么样免费做qq空间打开网页出现错误为什么打不开网页,出错不兼容vivo手机和软件不兼容怎么办?直播加速怎么让已拍摄好的视频加速ios7固件下载ios 7及以上固件请在设备上点信任在哪点数据库损坏数据库坏了怎么办mate8价格华为mate8手机参数配置如何,多少元安全漏洞如何发现系统安全漏洞虚拟专用网intranet,extranet,虚拟专用网与internet有什么区别与联系srv记录SRV记录的简介
域名投资 成都主机租用 vps论坛 查询ip地址 域名解析文件 淘宝二级域名 分销主机 安云加速器 缓存服务器 iis安装教程 空间服务商 150邮箱 小米数据库 刀片式服务器 php空间购买 免费dns解析 idc查询 空间登入 国外的代理服务器 免费网络 更多