Archive for April 2009
command line gmail; msmtp; 465
Just a few words about my attempt to use Gnus with msmtp. The first step was to launch msmtp without Gnus from command line. There are three ports related to smtp protocol: 25, 465, 587. Usually 25 is the plain smtp without encryption, the difference between the other two is that 587 uses TLS encryption and 465 uses SSL encryption. 587 is filtered in some way on my network (telnet to that port times out), so 465 is the one I use. The majority of examples and tutorials use 587, so I tried using those config files and steps but the port. The most important difference is in the .msmtprc file:
account gmail host smtp.gmail.com tls on tls_certcheck off tls_starttls off # this is the most important difference port 465 # not using 587 auth on user username # without the 'at gmail dot com' from username@gmail.com password your_password_connected_to_username
Without this most important change msmtp just hangs after printing out “reading recipients from the command line” which is really annoying because there’s no good search results on google what to do in such situations. With previous config file I was able to run msmtp as follows:
$ cat mail.txt
To: grault@do-not-send-mail-here.com
Subject: test msmtp
From: XY <no-such-user@gmail.com>
User-Agent: The command line MSMTP
test MSMTP
--
BRs,
Grault
$ msmtp -d -C .msmtprc -a gmail grault@do-not-send-mail-here.com < mail.txt
ignoring system configuration file C:\ProgramData\msmtprc.txt: No such file or d
irectory
loaded user configuration file .msmtprc
using account gmail from .msmtprc
host = smtp.gmail.com
port = 465
timeout = off
protocol = smtp
domain = localhost
auth = choose
user = no-such-user
password = *
ntlmdomain = (not set)
tls = on
tls_starttls = off
tls_trust_file = (not set)
tls_crl_file = (not set)
tls_key_file = (not set)
tls_cert_file = (not set)
tls_certcheck = off
tls_force_sslv3 = off
tls_min_dh_prime_bits = (not set)
tls_priorities = (not set)
auto_from = off
maildomain = (not set)
from = no-such-user@gmail.com
dsn_notify = (not set)
dsn_return = (not set)
keepbcc = off
logfile = (not set)
syslog = (not set)
reading recipients from the command line
TLS certificate information:
Owner:
Common Name: smtp.gmail.com
Organization: Google Inc
Locality: Mountain View
State or Province: California
Country: US
Issuer:
Common Name: Thawte Premium Server CA
Organization: Thawte Consulting cc
Organizational unit: Certification Services Division
Locality: Cape Town
State or Province: Western Cape
Country: ZA
Validity:
Activation time: Mon Jul 30 02:00:00 2007
Expiration time: Fri Jul 30 01:59:59 2010
Fingerprints:
SHA1: 5E:F7:E8:CE:1A:BE:D8:94:F2:77:45:5D:ED:38:46:4F:5D:D1:97:61
MD5: F1:D3:DE:59:9D:9C:E2:31:EA:AA:2C:A0:FC:AD:9A:61
<-- 220 mx.google.com ESMTP 37sm7124747yxl.35
--> EHLO localhost
<-- 250-mx.google.com at your service, [187.97.152.29]
<-- 250-SIZE 35651584
<-- 250-8BITMIME
<-- 250-AUTH LOGIN PLAIN
<-- 250-ENHANCEDSTATUSCODES
<-- 250 PIPELINING
--> AUTH PLAIN AVL4YWLvbGNuLnN6sWQzAGWkc2Z8eHN6rg==
<-- 235 2.7.0 Accepted
--> MAIL FROM:<no-such-user@gmail.com>
--> RCPT TO:<grault@do-not-send-mail-here.com>
--> DATA
<-- 250 2.1.0 OK 37sm7124747yxl.35
<-- 250 2.1.5 OK 37sm7124747yxl.35
<-- 354 Go ahead 37sm7124747yxl.35
--> To: grault@do-not-send-mail-here.com
--> Subject: test msmtp
--> From: XY <no-such-user@gmail.com>
--> User-Agent: The command line MSMTP
-->
--> test MSMTP
-->
--> --
--> BRs,
--> Grault
--> .
<-- 250 2.0.0 OK 1240471557 37sm7124747yxl.35
--> QUIT
<-- 221 2.0.0 closing connection 37sm7124747yxl.35
$ msmtp --version
msmtp version 1.4.17
TLS/SSL library: GnuTLS
Authentication library: GNU SASL
Supported authentication methods:
plain cram-md5 digest-md5 external login ntlm
IDN support: enabled
NLS: disabled
Keyring support: none
System configuration file name: C:\ProgramData\msmtprc.txt
User configuration file name: c:\users\grault\msmtprc.txt
Copyright (C) 2008 Martin Lambers and others.
This is free software. You may redistribute copies of it under the terms of
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
There is NO WARRANTY, to the extent permitted by law.
$ pwd
/cygdrive/c/users/grault
$
collecting coupons
I’m playing Mafia Wars on Facebook. By finishing a job, you have the chance to get a pecial item, which is part of one from the many collections. When a collection of yours is complete you can get a reward for it.
The action of getting a special item for a job is supposed to have Geometric distribution. So if the probability of getting a special item during that job is 0.1, then you’ll get special items, on average, after every 10 (1/0.1) jobs.
But what is the expected number of special items you have to collect, on average, to complete your collection? This is the Coupon collector’s problem. A lisp code for it is like this:
(defun e-coupon (m)
(loop as i from 1 upto m
sum (/ m
(+ 1 (- m i)))))
For m=7 (which is the usual number of different types of special items in a given collection) this is 18.15. So I expect one collection to be complete only after 181 jobs completed if previous paragraphs hold.