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.

无忧云(25元/月),国内BGP高防云服务器 2核2G5M

无忧云官网无忧云怎么样 无忧云服务器好不好 无忧云值不值得购买 无忧云,无忧云是一家成立于2017年的老牌商家旗下的服务器销售品牌,现由深圳市云上无忧网络科技有限公司运营,是正规持证IDC/ISP/IRCS商家,主要销售国内、中国香港、国外服务器产品,线路有腾讯云国外线路、自营香港CN2线路等,都是中国大陆直连线路,非常适合免北岸建站业务需求和各种负载较高的项目,同时国内服务器也有多个BGP以及高...

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

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

RackNerd美国大硬盘服务器促销:120G SSD+192TB HDD,1Gbps大带宽,月付$599,促销美国月付$服务器促销带宽

racknerd怎么样?racknerd最近发布了一些便宜美国服务器促销,包括大硬盘服务器,提供120G SSD+192TB HDD,有AMD和Intel两个选择,默认32G内存,1Gbps带宽,每个月100TB流量,5个IP地址,月付$599。价格非常便宜,需要存储服务器的朋友可以关注一下。RackNerd主要经营美国圣何塞、洛杉矶、达拉斯、芝加哥、亚特兰大、新泽西机房基于KVM虚拟化的VPS、...

sendmail为你推荐
快速美白好方法快速美白的好点子!?(不是晒黑的)人人逛街人人都喜欢逛街吗bluestackbluestacks下载的东西在哪小米手柄小米蓝牙游戏手柄怎么连接游戏blogcn怎样设置BLOGCN的访问密码blogcn哪种博客更好...sina.baidu.blogcn还是.............?如何清理ie缓存怎么清理IE缓存服务器连接异常服务器连接异常,即将退出,请重新进入游戏.怎么回事QzongQZONG怎么玩?王炳坤非诚勿扰、名叫周末的男嘉宾在哪一期。。。
中国万网虚拟主机 亚洲大于500m 香港bgp机房 hostmaster locvps bgp双线 域名评估 hktv 四核服务器 无限流量 cloudlink smtp虚拟服务器 网购分享 主机管理系统 东莞服务器托管 金主 稳定空间 中国联通宽带测试 免费稳定空间 godaddy空间 更多