Dovecot is an IMAP and POP3 server that runs on Unix-like operating systems. It is designed and developed with security system in mind, and is developed and released by Timo Sirainen etal.
perl sendmail
#!/usr/bin/perl require 'getformdata.pl'; # sendmailパス $sendmail = '/usr/sbin/sendmail'; # フォームデータの取得 %form = plab::getformdata(); # 個々の変数にコピー $name = $form{'name'}; $from = $form{'from'}; $subject = $form{'subject'}; $message = $form{'message'}; # メールの送信先は固定 $to = 'hoge@gmail.org'; # Fromメールアドレスが空だとエラーになるので、 # 空なら仮に送信先アドレスを入れる if($from eq ""){ $from = $to; } # sendmailを書き込みオープンする if(! open(MAIL, "|$sendmail -t")){ # sendmailの起動ができませんでした print "Content-type: text/html\n"; print "\n"; print "メール送信に失敗しました。"; # CGI終了 exit; } # チェック $name =~ s/\r|\n//g; $from =~ s/\r|\n//g; $to =~ s/\r|\n//g; $subject =~ s/\r|\n//g; # ヒアドキュメントを作る $mailtext = <<"EOM"; From: $name<$from> To: <$to> Subject: $subject Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="ISO-2022-JP" $message EOM # パイプを通してsendmailにデータを渡す print MAIL $mailtext; close MAIL; print "Content-type: text/html\n"; print "\n"; print "メールを送信しました。ありがとうございました"; exit;
sendmailはperlと関係なくメール送信プログラム
npm install aws-sdk –save
npm install の–saveオプションって何?
-> パッケージをインストールして、package.jsonに書き込む
[vagrant@localhost ses]$ npm -v
6.1.0
[vagrant@localhost ses]$ npm install aws-sdk –save
npm WARN saveError ENOENT: no such file or directory, open ‘/home/vagrant/local/app/test/package.json’
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ‘/home/vagrant/local/app/test/package.json’
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.
+ aws-sdk@2.487.0
added 39 packages from 85 contributors, removed 30 packages, updated 1 package and audited 52 packages in 30.333s
found 0 vulnerabilities
あれ、package.jsonがないです。
AWS credentialsを設定し、メール送信する
var AWS = require('aws-sdk'); AWS.config.update({region: 'us-east-1'}); var ses = new AWS.SES(); var params = { Destination: { ToAddresses: [ 'hoge@example.com' ] }, Message: { Body: { Text: { Data: 'hello SES', Charset: 'utf-8' } }, Subject: { Data: 'Hello', Charset: 'utf-8' } }, Source: 'jiro@example.com' }; ses.sendEmail(params, function(err, data){ if(err) console.log(err, err.stack); else console.log(data); });
jsonか。。
mkdir ${dirname} && cd $_
コマンドラインで「$_」は一つ前の引数
[vagrant@localhost test]$ echo hoge && echo $_ hoge hoge
$_でhogeを引っ張てきている
mkdirでやると、
[vagrant@localhost test]$ mkdir ses && cd $_
[vagrant@localhost ses]$
おお、なんか素晴らしいですね。
Amazon SES
Amazon Simple Email Service (SES) is Amazon’s email sending service.
Weight charge system, no minimum fee required.
Free quota is 62,000 transmissions / month from EC2 and 1,000 receptions / month.
Amazon SES Sandbox
– In order to prevent fraud and to avoid SPAM accreditation from ISPs, new user accounts are placed in a sandbox (environment for verification purposes) and limited in part by behavior.
– Emails can be sent and received only from verified email addresses or verified domains.
– You can send up to 200 messages per day, up to one message per second.
– If you move the account out out of the sandbox, it will work in the unrestricted environment.
– It will take 1 business day to proceed.
Identity
– Case- insensitive combination of domain and email address. (user@example.com and USER@example.com have different identities)
Domain Key Identification Mail(DKIM)
– It is a standard for the ISP to prove that senders have signed e-mail messages so that they are genuine and have not been tampered with by a third party during transmission.
fsockopen – smtp
Open an internet connection or Unix domain socket connection.
$fp = fsockopen("www.example.com", 80, $errno, $errstr, 30); if(!$fp){ echo "$errstr ($errno)<br>\n"; } else { $out = "GET / HTTP/1.1\r\n"; $out .= "Host: www.example.com\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); while (!feof($fp)){ echo fget($fp, 128); } fclose($fp); }
MX record
An MX record is a record that defines the mail destination host name for the target domain.
The mail transfer destination host name needs to be registered in A record. Refers to the A record set by the customer and acquires the IP address of the mail server. Therefore, please note that it will not operate normally if A record is not set.
配送先のメールサーバーを決定する際に使用。
ということは、配送先メールサーバーのAレコードって認識であってる?
あれ、結構複雑だなー
git fetch
pull = fetch + merge origin/master
What is “git fetch”?
For git, there are two repositories: remote and local. Fetch is a command that brings the latest information from the remote repository to the local repository. Fetching does not mean that the file is updated like pull. Only the local repository is updated.
[vagrant@localhost test]$ git –version
git version 1.7.1
[vagrant@localhost test]$ git clone https://github.com/githubix/test.git
Initialized empty Git repository in /home/vagrant/local/app/test/test/test/.git/
remote: Enumerating objects: 45, done.
remote: Total 45 (delta 0), reused 0 (delta 0), pack-reused 45
Unpacking objects: 100% (45/45), done.
[vagrant@localhost test]$ ls
test
[vagrant@localhost test]$ git log origin/master
commit e4c42320159a32a377eb60249f9d5277f809c1bd
Author: githubix <@hotmail.com>
Date: Mon Jul 1 23:16:01 2019 +0900
Update test.php
commit 180cf3fcce48d905ede71a57ed0bd3973e1f90c8
Author: githubix <@hotmail.com>
Date: Mon Jan 28 08:45:42 2019 +0900
Update test.php
commit 812d49e3beb82bafe3699787ade3de5bf5d2f48f
Author: githubix <@hotmail.com>
Date: Fri Jan 25 09:09:15 2019 +0900
Update test.php
commit 5b3c59d4795b3a73e8723b35ffa58b2a6c262974
[vagrant@localhost test]$ git fetch –all
Fetching origin
なんか理解が足りんな。。
curl command
What is curl command?
-> A command to transfer data from or to a server.
It supports many protocols such as FTP, SFTP, LDAP, TELNET.
The most basic usage is to use HTTP request and standard output.
curl [options] [url]# Make an HTTP request and put the result on the standard output
$ curl http://target URL# You can also specify the range using commas and []
$ curl 'http://{one, two, three}.example.com'
$ curl 'http://[1-3].example.com'# Output execution result to file
$ curl http://Target URL > Output Destination
$ curl -o output destination PATH http://target URL# Hide progress on file output(error is also hidden)
$curl -s -o output destionation Path http://target URL# if you want to display the error above
$curl -sS -o output destination PATH http://target URL# Display progress rate in progress bar
$curl -# -O http://Target URL# Skip certificate error on SSL connection
$ curl -k https://target URL# Download with URL filename(The following is saved as index.html)
$ curl -O http://target URL /index.html# Access via proxy
$ curl -x proxy server: port number --proxy-user username:password http://target URL# Enable redirection
$ curl -L http://Target URL# When you resume the download again when you interrupt the download
$ curl -C -http://target URL# Specification of HTTP method (-X)
$ curl -X PUT http://Target URLcurl -sS -Hは、エラー標示かつhttpヘッダにheader追加?
[vagrant@localhost ~]$ curl --version
curl 7.19.7 (x86_64-redhat-linux-gnu) libcurl/7.19.7 NSS/3.27.1 zlib/1.2.3 libidn/1.18 libssh2/1.4.2
Protocols: tftp ftp telnet dict ldap ldaps http file https ftps scp sftp
Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz[vagrant@localhost ~]$ curl -s -w '%{http_code}\n' http://www.amazon.co.jp/dp/B00JEYPPOE/ -o /dev/null
301
[vagrant@localhost ~]$ curl -s -w '%{http_code}\n' http://www.amazon.co.jp/dp/B00JEYPPOE/ -o /dev/null -A ''
301ん?
書評: カリスマ上下(オラクル ラリーエリソン)
オラクルの本を勧められて、ラリーエリソンのカリスマ上下巻を読了。上巻282ページ、下巻582ページ。
分量が多かったので、気分転換に甲府に行って、その車中で読んだ。
リレーショナルデータベースをIBMからぱくって、RDBの創成期から強力な営業力で推進した経緯が記載されている。
特筆すべきは、oracleを作る前に、幾つかの会社でプログラマーとして働いていたことだ。
本書ではセールスやエリソンのプライベートに関する記述が多いが、彼はプログラマーである。
だから、経営においても、エンジニアを大事にしていることが随所にわかる。
また、優秀な人材を採用し続けた、という点では、Googleに似ている。
彼が作った会社の最初の顧客がCIAというのは驚きである。スケールが違う。
また、アプリケーションの下請けではなく、パッケージソフトの販売という点でもプログラマーっぽい視点だ。
それがRDBだからこんなにシェアを取れたのだろう。
これから伸びそうなところに集中投資、というのは真似したい。