メール自動返信プログラム2 perlでの実装
カテゴリー:Linux
前回説明したようにメール転送プログラムである.forwardの設定を行えば、メールを受信したときに他のプログラムを実行するようにできます。前回はそのプログラムにprocmailを実行するように設定したのですが、「相手の送信元のアドレスを記号化(*今回はメール文字列を16進数のアスキーコードに変換)してURLを生成」という部分の実装がprocmailよりperlを利用したほうが短時間で行えそうなのでperlでの実装を行いました。その詳細について記事にしたいと思います。
.forwardの設定
.forwardの設定を変更して、メールを受信したときにperlのプログラムを実行するように変更します。
以下の設定では/home/autoresponseディレクトリにあるreturnmail.plを実行するように設定しています。
"|IFS=' ' && exec /usr/bin/perl /home/autoresponse/returnmail.pl || exit 75 autoresponse"
returnmail.pl
実際のコードを下記に載せておきます。
メールを送信する際にperlのEncodeモジュールを使用しています。
最初、nkfを利用して文字コードを変換して送信するプログラムを作成していましたが、文字化けの問題が起こったためperl側で変換するようにしました。この詳細に関しては次回の記事で書きたいと思います。
#/usr/bin/perl
use encoding 'utf8';
use Encode ;
#.forwardの出力からメールアドレスを取得して、さらに記号化
while (<STDIN>){
$content .= $_;
if ( $1 > 100000 ){ exit; }
if ( m/^From:.*$/ ){
$_ =~ s/From: //g;
$_ =~ s/From: //g;
$_ =~ s/^(.*)<(.*)>(.*)$/$2/g;
$_ =~ s/ //g;
$mailaddress = $_;
$ma16 = unpack("H*",$mailaddress);
}
}
#送信元のアドレスを指定、送信先には上で取得したアドレスを指定
$from = "autoresponse@nanbu.com";
$to = $mailaddress;
#sendmailを利用してメールを送信
open MAIL, "| /usr/sbin/sendmail -f $from -t $to,foo@bar.com";
print MAIL "From: $from ";
print MAIL "Subject:タイトル
";
print MAIL "To: $to ";
print MAIL " ";
print MAIL Encode::encode ( '7bit-jis' , "以下のアドレスを押してください。 ");
print MAIL Encode::encode ( '7bit-jis' , "http://www.foo.com/bar/foo.php?mail=".$ma16." ");
close MAIL;
関連記事
Track Back URL
- -
- gratis tragaperras-gratis tragaperras
- ting tomes- conversancy masseuse
- buy cheap viagra- buy viagra
- buy discount viagra- buy viagra
- alprazolam- alprazolam
- butalbital- butalbital 50
- hydrocodone- hydrocodone
- ultram- cheapest ultram
- valium- valium without prescription
- vicodin- vicodin
- diazepam tablets- diazepam 2mg
- buying vicodin online- vicodin
- viagra- viagra buy
- viagra- viagra
- buy viagra online- viagra
- cheap viagra- discount viagra
- acyclovir- acyclovir no prescription
- xenical on line- cheap xenical
- alprazolam 1mg- alprazolam
- butalbital- butalbital 50
- drug celexa- celexa 20mg
- diazepam- diazepam
- fioricet- fioricet
- hydrocodone acetaminophen- generic hydrocodone
- levitra- levitra
- meridia- meridia weight loss
- buy paxil online- paxil
- antidepressants prozac- prozac
- buy tramadol cod- tramadol
- valium- valium cod
- vicodin cod- vicodin
- wellbutrin prescription- wellbutrin
- overnight acyclovir- acyclovir tablets
- adipex online pharmacy- adipex
- ativan- ativan without prescription
- carisoprodol without prescription- carisoprodol
- cialis- cialis
- fioricet- buy cheap fioricet
- hydrocodone- hydrocodone cheap
- levitra prescriptions- levitra buy
- paxil medication- paxil
- propecia- propecia price
- tadalafil- tadalafil soft tab
- ultram- ultram medication
- viagra- viagra
- vicodin online no prescription- vicodin
- wellbutrin- wellbutrin
- xenical- xenical
- acyclovir 800- acyclovir
- acyclovir pill- acyclovir
- ambien- discount ambien
- butalbital- butalbital medication
- celexa antidepressant- buy celexa
- cialis- cialis online
- diazepam- diazepam
- fioricet- fioricet
- hydrocodone- hydrocodone
- levitra- levitra cheapest
- meridia- meridia
- generic paxil- paxil
- soma 350- soma
- timex watch ironman- timex watch ironman
- tracy roberson devin lasalle- tracy roberson devin lasalle
- september dawn wiki- september dawn wiki
- september dawn wikipedia- september dawn wikipedia
- iron man war machine wallpaper- iron man war machine wallpaper
- mach 5 wheels- mach 5 wheels
- dark half guild- dark half guild
- lupe velez 1943- lupe velez 1943
- iron man cast photo- iron man cast photo
- scream blacula scream- scream blacula scream
- watch zoey 101 chasing zoey- watch zoey 101 chasing zoey
- animal house script- animal house script
- zoey 101 oneowin- zoey 101 oneowin
- kobe mvp playoffs- kobe mvp playoffs
- looptopia chicago alliance- looptopia chicago alliance
- fbi most wanted top 10- fbi most wanted top 10
- space elevator competition- space elevator competition
- americana at brand glendale- americana at brand glendale
- please investigate your browser- please investigate your browser
- rodgers and hammerstein musicals- rodgers and hammerstein musicals
- mighty avengers movie- mighty avengers movie
- dan duryea 1944- dan duryea 1944
- sat prep courses- sat prep courses
- watch ironman trailer- watch ironman trailer
- watch ironman live- watch ironman live
- messiah 2 vengeance is mine- messiah 2 vengeance is mine
- watch chasing zoey- watch chasing zoey
- christine nguyen celebrity- christine nguyen celebrity
- ana ts miami goddess- ana ts miami goddess
- marvel avengers movie- marvel avengers movie
- iron man cast list- iron man cast list
- dan duryea bounty killer- dan duryea bounty killer
- nona dirksmeyer boyfriend- nona dirksmeyer boyfriend
- lisa lopes death- lisa lopes death
- varsity blues script- varsity blues script
- joe pichler varsity blues- joe pichler varsity blues
- king and i restaurant- king and i restaurant
- captain america movie 2008- captain america movie 2008
- miami goddess- miami goddess
- new avengers marvel- new avengers marvel
- iron man cast pictures- iron man cast pictures
- bad moon rising tab- bad moon rising tab
- bing crosby internet museum- bing crosby internet museum
- dan duryea bio- dan duryea bio
- sat tips and hints- sat tips and hints
- kentucky derby post time 2008- kentucky derby post time 2008
- invincible iron man cast- invincible iron man cast
- mach 5- mach 5
- joanna shimkus 1968- joanna shimkus 1968
- anthonyiminlog- anthonyiminlog
- actos- actos
- amoxil- amoxil
- biaxin- biaxin
- celebrex- celebrex
- cipro- cipro
- clonazepam- clonazepam
- doxycycline- doxycycline
- effexor- effexor
- elavil- elavil
- lipitor- lipitor
- norvasc- norvasc
- plavix- plavix
- prilosec- prilosec
- cutco cutlery corp- cutco cutlery corp
- lake county indiana assessors office- lake county indiana assessors office
- tokyo earthquake japan- tokyo earthquake japan
- theta chi fraternity san diego state- theta chi fraternity san diego state
- bernie ward kgo radio- bernie ward kgo radio
- what is krabbe disease- what is krabbe disease
- shirley poliakoff toxicology- shirley poliakoff toxicology
- hasan elahi blog- hasan elahi blog
- antonio pierce nfl- antonio pierce nfl
- alvin york museum- alvin york museum
- 2009 prius next generation mpg- 2009 prius next generation mpg
- download free porn movies- download free porn movies
- free teen porn galleries- free teen porn galleries
- we love free porn- we love free porn
- free anime porn galleries- free anime porn galleries
- free xxx porn gallery- free xxx porn gallery
- free anime porn gallery- free anime porn gallery
- free porn movie trailers- free porn movie trailers
- sample porn movie trailers- sample porn movie trailers
- free porno movie clips- free porno movie clips
- free final fantasy porn- free final fantasy porn
- free porno video clips- free porno video clips
- 12 year old porn- 12 year old porn
- free mature porn- free mature porn
- free mature porn thumbnails- free mature porn thumbnails
- paris hilton porn movie- paris hilton porn movie
- traci lords porn clips- traci lords porn clips
- simpsons fuck porn free- simpsons fuck porn free
- full metal alchemist porn- full metal alchemist porn
- hot sex porn nude- hot sex porn nude
- big tit porn- big tit porn
- how to become a porn star- how to become a porn star
- free mpeg porn samples- free mpeg porn samples
- here is the porn- here is the porn
- free porn older women- free porn older women
- free hentai sex porn- free hentai sex porn
- free marge simpsons porn- free marge simpsons porn
- free teen lesbian porn- free teen lesbian porn
- brooke biggs porn movies- brooke biggs porn movies
- husband and wife porn- husband and wife porn
- free porn sample videos- free porn sample videos
- legend of zelda porn- legend of zelda porn
- free online porno games- free online porno games
- free gay asian porn- free gay asian porn
- tarzan and jane porn- tarzan and jane porn
- video porn sample clips- video porn sample clips
- free porn soccer moms- free porn soccer moms
- peer to peer porn- peer to peer porn
- watch paris hilton porno- watch paris hilton porno
- free online porno games- free online porno games
- free gay asian porn- free gay asian porn
- sailor moon porn free- sailor moon porn free
- 13 year old girl porn- 13 year old girl porn
- free porn clips mpeg- free porn clips mpeg
- kim possible porn comics- kim possible porn comics
- free porn e-mail no credit card- free porn e-mail no credit card
- porno mpeg clips for free- porno mpeg clips for free
- marks bookmarks free porn- marks bookmarks free porn
- porn video on demand- porn video on demand
- free sample porno videos- free sample porno videos
- we are making porn- we are making porn
- barely legal teen porn- barely legal teen porn
- free quick porn vids- free quick porn vids
- list of black pornstars- list of black pornstars
- free porn without membership- free porn without membership
- free live web cam porn- free live web cam porn
- free hardcore full length porn movies- free hardcore full length porn movies
- free hardcore porn video- free hardcore porn video
- free black porn mpegs- free black porn mpegs
- hechos y actos juridicos- hechos y actos juridicos
- generic adderall- generic adderall
- atenolol reactions- atenolol reactions
- bactrim side affects- bactrim side affects
- biaxin used to treat- biaxin used to treat
- bupropion sr 100mg- bupropion sr 100mg
- cephalexin effects- cephalexin effects
- cipro hc otic- cipro hc otic
- clonazepam indications- clonazepam indications
- doxycycline and yeast infection- doxycycline and yeast infection
- cheralanondetlog- cheralanondetlog
- debbiesugihlog- debbiesugihlog
- lounettegeorginalog- lounettegeorginalog
- prattsusannelog- prattsusannelog
- tuandhirajlog- tuandhirajlog
- generic altace- altace
- order augmentin- augmentin online
- cheap bupropion- bupropion
- buy celebrex online- order celebrex
- cipro- order cipro
- buy codeine online- buy codeine
- discount doxycycline- generic doxycycline
- effexor online- effexor online
- cheap glucophage- cheap glucophage
- lamisil- online lamisil
- generic levaquin- levaquin
- order lipitor- buy lipitor online
- buy norvasc online- order norvasc
- online prevacid- online prevacid
- buy prilosec- prilosec online
- purchase zanaflex- online zanaflex
- online zovirax- discount zovirax
- buy cheap cialis- cialis prescription
- buy cheap cialis- cialis drug
- order cialis online- cialis fedex
- buy cialis online- cialis fedex
- cialis fedex- buy cheap cialis
- generic cialis online- discount cialis
- discount cialis- order cialis online
- cheap cialis- generic cialis online
- cheap cialis- cialis fedex
- acyclovir no prescription- acyclovir pill
- cheap adipex- adipex diet pill
- ambien 10 mg- ambien drug
- ativan 1mg- ativan 1mg
- butalbital no prescription- butalbital no prescription
- carisoprodol soma- carisoprodol no prescription
- celexa antidepressant- drug celexa
- cialis online pharmacy- cialis online
- diazepam 10mg- diazepam tablets
- fioricet generic- order fioricet online
- hydrocodone online no prescription- cheap hydrocodone
- levitra vardenafil- cialis levitra
- low cost meridia- cheap meridia online
- buy paxil- paxil cr
- hair loss propecia- generic propecia
- prozac 20- order prozac
- cheap soma online- cheap soma online
- tadalafil 20mg- tadalafil discount
- tramadol pill- cheapest tramadol
- ultram tramadol- order ultram
- buy valium online- valium 20mg
- vicodin generic- order vicodin online
- wellbutrin prescription- cheap wellbutrin
- orlistat xenical- discount xenical
- altace online- altace
- actos- generic actos
- purchase augmentin- order augmentin
- cheap biaxin- purchase biaxin
- discount bupropion- cheap bupropion
- order celebrex- cheap celebrex
- generic cipro- order cipro
- clonazepam- discount clonazepam
- codeine online- buy codeine online
- order doxycycline- cheap doxycycline
- discount effexor- order effexor
- purchase elavil- order elavil
- cheap famvir- online famvir
- buy glucophage online- glucophage
- buy klonopin- buy klonopin online
- lamisil- discount lamisil
- order lasix- order lasix
- online levaquin- levaquin online
- online lipitor- lipitor
- online norvasc- online norvasc
- buy plavix- cheap plavix
- online prevacid- online prevacid
- prilosec- prilosec
- discount&