Fix unhandled errors in mail.js
Fix unhandled errors in mail.js

fixes #1718

- check for existence of mail before using properties
- return the promise properly

chevex/undoctrinate,djensen47/Ghost,kolorahl/Ghost,sebgie/Ghost,lowkeyfred/Ghost,Romdeau/Ghost,Brunation11/Ghost,duyetdev/islab,laispace/laiblog,dgem/Ghost,francisco-filho/Ghost,rollokb/Ghost,jiachenning/Ghost,wspandihai/Ghost,InnoD-WebTier/hardboiled_ghost,prosenjit-itobuz/Ghost,tandrewnichols/ghost,flomotlik/Ghost,optikalefx/Ghost,thinq4yourself/Unmistakable-Blog,Gargol/Ghost,situkangsayur/Ghost,cncodog/Ghost-zh-codog,ClarkGH/Ghost,telco2011/Ghost,LeandroNascimento/Ghost,jeonghwan-kim/Ghost,telco2011/Ghost,AlexKVal/Ghost,camilodelvasto/herokughost,floofydoug/Ghost,Shauky/Ghost,nneko/Ghost,vainglori0us/urban-fortnight,Bunk/Ghost,smedrano/Ghost,Polyrhythm/dolce,letsjustfixit/Ghost,Japh/Ghost,melissaroman/ghost-blog,madole/diverse-learners,GroupxDev/javaPress,Kikobeats/Ghost,handcode7/Ghost,pbevin/Ghost,jomofrodo/ccb-ghost,mikecastro26/ghost-custom,kwangkim/Ghost,e10/Ghost,mdbw/ghost,delgermurun/Ghost,ITJesse/Ghost-zh,flomotlik/Ghost,epicmiller/pages,JohnONolan/Ghost,sebgie/Ghost,ignasbernotas/nullifer,kwangkim/Ghost,Xibao-Lv/Ghost,Xibao-Lv/Ghost,allanjsx/Ghost,novaugust/Ghost,Coding-House/Ghost,alanmoo/moo-on-the-web,halfdan/Ghost,jamesslock/Ghost,sfpgmr/Ghost,uploadcare/uploadcare-ghost-demo,handcode7/Ghost,jacostag/Ghost,obsoleted/Ghost,psychobunny/Ghost,aschmoe/jesse-ghost-app,Azzurrio/Ghost,Jai-Chaudhary/Ghost,10hacks/blog,MadeOnMars/Ghost,GarrethDottin/Habits-Design,no1lov3sme/Ghost,davidblurton/salmondesign-old,UsmanJ/Ghost,jomahoney/Ghost,Yarov/yarov,davegw/dgw-website,thehogfather/Ghost,developer-prosenjit/Ghost,etdev/blog,javorszky/Ghost,imjerrybao/Ghost,JulienBrks/Ghost,rizkyario/Ghost,davidenq/Ghost-Blog,johnnymitch/Ghost,hilerchyn/Ghost,ThorstenHans/Ghost,mhhf/ghost-latex,shannonshsu/Ghost,denzelwamburu/denzel.xyz,singular78/Ghost,Azzurrio/Ghost,allspiritseve/mindlikewater,camilodelvasto/localghost,delgermurun/Ghost,llv22/Ghost,acburdine/Ghost,ashishapy/ghostpy,acburdine/Ghost,davegw/dgw-website,memezilla/Ghost,choskim/GhostAzure,Netazoic/bad-gateway,YY030913/Ghost,atandon/Ghost,Empeeric/justanidea,dYale/blog,davidblurton/salmondesign-old,JonathanZWhite/Ghost,ddeveloperr/Ghost,adam-paterson/blog,johnnymitch/Ghost,JulienBrks/Ghost,MadeOnMars/Ghost,neynah/GhostSS,ignasbernotas/nullifer,wspandihai/Ghost,lcamacho/Ghost,dai-shi/Ghost,vainglori0us/urban-fortnight,mayconxhh/Ghost,codeincarnate/Ghost,ErisDS/Ghost,Smile42RU/Ghost,Japh/shortcoffee,DesenTao/Ghost,diogogmt/Ghost,NikolaiIvanov/Ghost,ryansukale/ux.ryansukale.com,icowan/Ghost,phillipalexander/Ghost,zuphu/GhostBlog,tuan/Ghost,patterncoder/patterncoder,NamedGod/Ghost,thinq4yourself/Unmistakable-Blog,TribeMedia/Ghost,choskim/GhostAzure,load11/ghost,mohanambati/Ghost,InnoD-WebTier/hardboiled_ghost,vainglori0us/urban-fortnight,edurangel/Ghost,Jonekee/Ghost,memezilla/Ghost,bigertech/Ghost,wangjun/Ghost,vloom/blog,djensen47/Ghost,kevinansfield/Ghost,trunk-studio/Ghost,hyokosdeveloper/Ghost,hnarayanan/narayanan.co,Trendy/Ghost,ryansukale/ux.ryansukale.com,JonSmith/Ghost,YY030913/Ghost,mdbw/ghost,devleague/uber-hackathon,Alxandr/Blog,smaty1/Ghost,pbevin/Ghost,Klaudit/Ghost,yundt/seisenpenji,aroneiermann/GhostJade,AnthonyCorrado/Ghost,allspiritseve/mindlikewater,camilodelvasto/localghost,wemakeweb/Ghost,jomofrodo/ccb-ghost,Jai-Chaudhary/Ghost,dbalders/Ghost,choskim/Ghost,cgiffard/Ghost,rouanw/Ghost,schneidmaster/theventriloquist.us,cncodog/Ghost-zh-codog,RufusMbugua/TheoryOfACoder,ljhsai/Ghost,cobbspur/Ghost,exsodus3249/Ghost,lf2941270/Ghost,kortemy/Ghost,ngosinafrica/SiteForNGOs,akveo/akveo-blog,lukaszklis/Ghost,optikalefx/Ghost,qdk0901/Ghost,johngeorgewright/blog.j-g-w.info,thehogfather/Ghost,Kaenn/Ghost,IbrahimAmin/Ghost,Smile42RU/Ghost,leonli/ghost,rafaelstz/Ghost,TryGhost/Ghost,ManRueda/manrueda-blog,Sebastian1011/Ghost,Klaudit/Ghost,ygbhf/Ghost,rito/Ghost,beautyOfProgram/Ghost,zumobi/Ghost,Aaron1992/Ghost,devleague/uber-hackathon,schneidmaster/theventriloquist.us,r14r/fork_nodejs_ghost,Sing-Li/GhostSS,mattvh/Ghost,mohanambati/Ghost,notno/Ghost,SkynetInc/steam,leonli/ghost,daihuaye/Ghost,MrMaksimize/sdg1,trepafi/ghost-base,tksander/Ghost,zeropaper/Ghost,dYale/blog,alexandrachifor/Ghost,janvt/Ghost,eduardojmatos/eduardomatos.me,Feitianyuan/Ghost,sunh3/Ghost,mnitchie/Ghost,sfpgmr/Ghost,riyadhalnur/Ghost,novaugust/Ghost,olsio/Ghost,sajmoon/Ghost,morficus/Ghost,ckousik/Ghost,ballPointPenguin/Ghost,theonlypat/Ghost,achimos/ghost_as,claudiordgz/Ghost,mnitchie/Ghost,rchrd2/Ghost,ivantedja/ghost,KnowLoading/Ghost,AnthonyCorrado/Ghost,jacostag/Ghost,skmezanul/Ghost,lethalbrains/Ghost,bisoe/Ghost,cqricky/Ghost,nneko/Ghost,rafaelstz/Ghost,johngeorgewright/blog.j-g-w.info,Loyalsoldier/Ghost,jgillich/Ghost,petersucks/blog,kevinansfield/Ghost,choskim/ghost_exp,RufusMbugua/TheoryOfACoder,lethalbrains/Ghost,JohnONolan/Ghost,jiangjian-zh/Ghost,sergeylukin/Ghost,RoopaS/demo-intern,vloom/blog,codeincarnate/Ghost,chris-yoon90/Ghost,ineitzke/Ghost,pathayes/FoodBlog,javimolla/Ghost,dbalders/Ghost,Romdeau/Ghost,ghostchina/Ghost-zh,Netazoic/bad-gateway,edsadr/Ghost,BayPhillips/Ghost,virtuallyearthed/Ghost,smedrano/Ghost,hyokosdeveloper/Ghost,jorgegilmoreira/ghost,praveenscience/Ghost,LeandroNascimento/Ghost,yangli1990/Ghost,ericbenson/GhostAzureSetup,adam-paterson/blog,rouanw/Ghost,flpms/ghost-ad,sajmoon/Ghost,etanxing/Ghost,camilodelvasto/herokughost,rwjblue/Ghost,bsansouci/Ghost,acburdine/Ghost,10hacks/blog,zumobi/Ghost,dqj/Ghost,PepijnSenders/whatsontheotherside,pensierinmusica/Ghost,ryanbrunner/crafters,BayPhillips/Ghost,vlmhco/personal-blog,rollokb/Ghost,hawkrives/Wraith,rmoorman/Ghost,liftup/ghost,Japh/Ghost,xiongjungit/Ghost,ryanbrunner/crafters,novaugust/Ghost,aroneiermann/GhostJade,ClarkGH/Ghost,hawkrives/Wraith,icowan/Ghost,claudiordgz/Ghost,sangcu/Ghost,duyetdev/islab,syaiful6/Ghost,carlyledavis/Ghost,greyhwndz/Ghost,FredericBernardo/Ghost,lf2941270/Ghost,tadityar/Ghost,NodeJSBarenko/Ghost,jparyani/GhostSS,patrickdbakke/ghost-spa,ghostchina/Ghost-zh,disordinary/Ghost,tidyui/Ghost,jomahoney/Ghost,theonlypat/Ghost,rameshponnada/Ghost,leninhasda/Ghost,riyadhalnur/Ghost,sergeylukin/Ghost,cicorias/Ghost,shannonshsu/Ghost,ananthhh/Ghost,gabfssilva/Ghost,sceltoas/Ghost,greenboxindonesia/Ghost,Jonekee/Ghost,floofydoug/Ghost,sunh3/Ghost,zackslash/Ghost,manishchhabra/Ghost,Gargol/Ghost,telco2011/Ghost,karmakaze/Ghost,dggr/Ghost-sr,disordinary/Ghost,atandon/Ghost,patterncoder/patterncoder,shrimpy/Ghost,sceltoas/Ghost,ErisDS/Ghost,ericbenson/GhostAzureSetup,allanjsx/Ghost,hoxoa/Ghost,thomasalrin/Ghost,darvelo/Ghost,ashishapy/ghostpy,Kaenn/Ghost,skleung/blog,rmoorman/Ghost,UnbounDev/Ghost,daihuaye/Ghost,UsmanJ/Ghost,julianromera/Ghost,JonSmith/Ghost,KnowLoading/Ghost,ASwitlyk/Ghost,benstoltz/Ghost,PeterCxy/Ghost,ngosinafrica/SiteForNGOs,mohanambati/Ghost,diogogmt/Ghost,jin/Ghost,prosenjit-itobuz/Ghost,tidyui/Ghost,diancloud/Ghost,schematical/Ghost,hnarayanan/narayanan.co,VillainyStudios/Ghost,sangcu/Ghost,gabfssilva/Ghost,r14r/fork_nodejs_ghost,tyrikio/Ghost,weareleka/blog,kmeurer/Ghost,ghostchina/website,fredeerock/atlabghost,leninhasda/Ghost,petersucks/blog,neynah/GhostSS,ManRueda/manrueda-blog,jamesyothers/Ghost,Netazoic/bad-gateway,dai-shi/Ghost,ladislas/ghost,axross/ghost,rito/Ghost,kolorahl/Ghost,bitjson/Ghost,pedroha/Ghost,cwonrails/Ghost,SkynetInc/steam,augbog/Ghost,NovaDevelopGroup/Academy,netputer/Ghost,praveenscience/Ghost,tmp-reg/Ghost,tmp-reg/Ghost,llv22/Ghost,nakamuraapp/new-ghost,alecho/Ghost,diancloud/Ghost,pedroha/Ghost,omaracrystal/Ghost,singular78/Ghost,rchrd2/Ghost,gleneivey/Ghost,dgem/Ghost,freele/ghost,jin/Ghost,UnbounDev/Ghost,uploadcare/uploadcare-ghost-demo,katiefenn/Ghost,ineitzke/Ghost,javimolla/Ghost,qdk0901/Ghost,sifatsultan/js-ghost,Coding-House/Ghost,ThorstenHans/Ghost,francisco-filho/Ghost,bsansouci/Ghost,klinker-apps/ghost,STANAPO/Ghost,kaiqigong/Ghost,JonathanZWhite/Ghost,denzelwamburu/denzel.xyz,exsodus3249/Ghost,barbastan/Ghost,cwonrails/Ghost,hnq90/Ghost,pathayes/FoodBlog,jparyani/GhostSS,velimir0xff/Ghost,dymx101/Ghost,influitive/crafters,ygbhf/Ghost,daimaqiao/Ghost-Bridge,madole/diverse-learners,mttschltz/ghostblog,tanbo800/Ghost,axross/ghost,Japh/shortcoffee,ManRueda/Ghost,jaswilli/Ghost,yundt/seisenpenji,alecho/Ghost,pollbox/ghostblog,AileenCGN/Ghost,GroupxDev/javaPress,v3rt1go/Ghost,aexmachina/blog-old,mattchupp/blog,consoleblog/consoleblog,Remchi/Ghost,chris-yoon90/Ghost,jaswilli/Ghost,Dnlyc/Ghost,skmezanul/Ghost,vishnuharidas/Ghost,Rovak/Ghost,PDXIII/Ghost-FormMailer,daimaqiao/Ghost-Bridge,Yarov/yarov,panezhang/Ghost,jamesyothers/Ghost,epicmiller/pages,cicorias/Ghost,avh4/blog.avh4.net,wangjun/Ghost,cysys/ghost-openshift,Kaenn/Ghost,dylanchernick/ghostblog,stridespace/Ghost,mhhf/ghost-latex,veyo-care/Ghost,jeonghwan-kim/Ghost,bbmepic/Ghost,Kikobeats/Ghost,netputer/Ghost,bastianbin/Ghost,wallmarkets/Ghost,developer-prosenjit/Ghost,kevinansfield/Ghost,veyo-care/Ghost,katrotz/blog.katrotz.space,zackslash/Ghost,ASwitlyk/Ghost,neynah/GhostSS,pensierinmusica/Ghost,aschmoe/jesse-ghost-app,hnq90/Ghost,carlosmtx/Ghost,situkangsayur/Ghost,NamedGod/Ghost,NovaDevelopGroup/Academy,andrewconnell/Ghost,ITJesse/Ghost-zh,TryGhost/Ghost,NovaDevelopGroup/Academy,uniqname/everydaydelicious,mtvillwock/Ghost,cysys/ghost-openshift,jorgegilmoreira/ghost,PaulBGD/Ghost-Plus,davidenq/Ghost-Blog,ManRueda/Ghost,velimir0xff/Ghost,bosung90/Ghost,cqricky/Ghost,kaychaks/kaushikc.org,mattvh/Ghost,lowkeyfred/Ghost,davidmenger/nodejsfan,javorszky/Ghost,phillipalexander/Ghost,arvidsvensson/Ghost,tadityar/Ghost,ryanorsinger/tryghost,gcamana/Ghost,tandrewnichols/ghost,ManRueda/Ghost,rameshponnada/Ghost,jparyani/GhostSS,jamesslock/Ghost,gleneivey/Ghost,anijap/PhotoGhost,laispace/laiblog,dylanchernick/ghostblog,Dnlyc/Ghost,carlosmtx/Ghost,olsio/Ghost,mlabieniec/ghost-env,ghostchina/Ghost.zh,cysys/ghost-openshift,lukekhamilton/Ghost,davidenq/Ghost-Blog,kaiqigong/Ghost,mtvillwock/Ghost,katrotz/blog.katrotz.space,yangli1990/Ghost,PDXIII/Ghost-FormMailer,jiangjian-zh/Ghost,Elektro1776/javaPress,SachaG/bjjbot-blog,scopevale/wethepeopleweb.org,yanntech/Ghost,arvidsvensson/Ghost,edurangel/Ghost,v3rt1go/Ghost,dggr/Ghost-sr,ckousik/Ghost,mattchupp/blog,load11/ghost,ladislas/ghost,lukw00/Ghost,janvt/Ghost,singular78/Ghost,bastianbin/Ghost,Alxandr/Blog,BlueHatbRit/Ghost,melissaroman/ghost-blog,DesenTao/Ghost,ljhsai/Ghost,cncodog/Ghost-zh-codog,skleung/blog,kmeurer/Ghost,hilerchyn/Ghost,Kikobeats/Ghost,leonli/ghost,Netazoic/bad-gateway,manishchhabra/Ghost,Feitianyuan/Ghost,dggr/Ghost-sr,oimou-house/blog,ErisDS/Ghost,mttschltz/ghostblog,r1N0Xmk2/Ghost,tanbo800/Ghost,e10/Ghost,jgladch/taskworksource,mlabieniec/ghost-env,jomofrodo/ccb-ghost,mlabieniec/ghost-env,wemakeweb/Ghost,cwonrails/Ghost,etanxing/Ghost,VillainyStudios/Ghost,darvelo/Ghost,bisoe/Ghost,yujingz/yujignz.com,letsjustfixit/Ghost,bbmepic/Ghost,Brunation11/Ghost,FredericBernardo/Ghost,daimaqiao/Ghost-Bridge,JohnONolan/Ghost,blankmaker/Ghost,kortemy/Ghost,PaulBGD/Ghost-Plus,jiachenning/Ghost,ivanoats/ivanstorck.com,sebgie/Ghost,kortemy/Ghost,jaguerra/Ghost,metadevfoundation/Ghost,shrimpy/Ghost,SachaG/bjjbot-blog,pollbox/ghostblog,tchapi/igneet-blog,Remchi/Ghost,gcamana/Ghost,Rovak/Ghost,etdev/blog,liftup/ghost,Trendy/Ghost,tksander/Ghost,hoxoa/Ghost,ManRueda/manrueda-blog,lukw00/Ghost,STANAPO/Ghost,makapen/Ghost,TryGhost/Ghost,tyrikio/Ghost,influitive/crafters,no1lov3sme/Ghost,omaracrystal/Ghost,achimos/ghost_as,anijap/PhotoGhost,jorgegilmoreira/ghost,akveo/akveo-blog,ddeveloperr/Ghost,carlyledavis/Ghost,PepijnSenders/whatsontheotherside,BlueHatbRit/Ghost,greenboxindonesia/Ghost,Loyalsoldier/Ghost,andrewconnell/Ghost,psychobunny/Ghost,ballPointPenguin/Ghost,dymx101/Ghost,woodyrew/Ghost,jaguerra/Ghost,sankumsek/Ghost-ashram,dqj/Ghost,Sebastian1011/Ghost,lukekhamilton/Ghost,NikolaiIvanov/Ghost,TribeMedia/Ghost,lanffy/Ghost,devleague/uber-hackathon,woodyrew/Ghost,stridespace/Ghost,IbrahimAmin/Ghost,obsoleted/Ghost,laispace/laiblog,stridespace/Ghost,Elektro1776/javaPress,rizkyario/Ghost,GarrethDottin/Habits-Design,ivanoats/ivanstorck.com,panezhang/Ghost,klinker-apps/ghost,barbastan/Ghost,wallmarkets/Ghost,xiongjungit/Ghost,lanffy/Ghost,karmakaze/Ghost,weareleka/blog,r1N0Xmk2/Ghost,AlexKVal/Ghost,k2byew/Ghost,InnoD-WebTier/hardboiled_ghost,nmukh/Ghost,yujingz/yujignz.com,virtuallyearthed/Ghost,morficus/Ghost,halfdan/Ghost,sifatsultan/js-ghost,ananthhh/Ghost,thomasalrin/Ghost,nmukh/Ghost,mayconxhh/Ghost,benstoltz/Ghost,beautyOfProgram/Ghost,ghostchina/Ghost.zh,trunk-studio/Ghost,schematical/Ghost,bitjson/Ghost,PeterCxy/Ghost,rtorino/me-etc,smaty1/Ghost,fredeerock/atlabghost,lukaszklis/Ghost,davidmenger/nodejsfan,syaiful6/Ghost,jgillich/Ghost,makapen/Ghost,kmeurer/GhostAzureSetup,notno/Ghost,k2byew/Ghost,blankmaker/Ghost,dbalders/Ghost,greyhwndz/Ghost,Bunk/Ghost,flpms/ghost-ad,imjerrybao/Ghost,Alxandr/Blog,letsjustfixit/Ghost,zhiyishou/Ghost,rizkyario/Ghost,augbog/Ghost,GroupxDev/javaPress,allanjsx/Ghost,zhiyishou/Ghost,yanntech/Ghost,metadevfoundation/Ghost,choskim/Ghost,edsadr/Ghost,krahman/Ghost,kaychaks/kaushikc.org,bosung90/Ghost,zeropaper/Ghost,julianromera/Ghost,Elektro1776/javaPress