"Fossies" - the Fresh Open Source Software Archive
Member "swaks-20201014.0/doc/recipes.txt" (14 Oct 2020, 3265 Bytes) of package /linux/privat/swaks-20201014.0.tar.gz:
As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard
) with prefixed line numbers.
Alternatively you can here view
the uninterpreted source code file.
See also the last Fossies "Diffs"
side-by-side code changes report for "recipes.txt": 20181104.0_vs_20190914.0
1 Swaks - Recipes for use
2 Because Swaks is a very flexible tool it can be hard to fully grasp what
3 it can do (and few people want or need to). However, I have used Swaks
4 in interesting ways, and others have done the same and shared them with
5 me. I hate for these interesting ideas go to waste, so I am including
6 them in this file.
8 Simple address verification
9 I have had the following in my kshrc for years:
11 alias vrfy='swaks -q rcpt -t'
13 This allows you to quickly ask a mail server whether a recipient is
14 valid (depending on how the mail server is configured, of course).
15 Example output:
17 g3 0 /home/jj33 > vrfy email@example.com
18 === Trying mx2.balanced.spacey.mail.dreamhost.com:25...
19 === Connected to mx2.balanced.spacey.mail.dreamhost.com.
20 <- 220 spaceymail-mx3.g.dreamhost.com ESMTP
21 -> EHLO g3.jetmore.net
22 <- 250-spaceymail-mx3.g.dreamhost.com
23 <- 250-PIPELINING
24 <- 250-SIZE 40960000
25 <- 250-ETRN
26 <- 250-STARTTLS
27 <- 250 8BITMIME
28 -> MAIL FROM:<firstname.lastname@example.org>
29 <- 250 Ok
30 -> RCPT TO:<email@example.com>
31 <- 250 Ok
32 -> QUIT
33 <- 221 Bye
34 g3 0 /home/jj33 >
36 This is a valid email (the mail server returned 250 in response to my
37 RCPT request). This is fairly verbose though. Note the "0" in my command
38 prompt is the exit status of the last command ($?). Since Swaks tries to
39 be good about setting a useful return value, I could make vrfy totally
42 g3 0 /home/jj33 > alias vrfy='swaks -q rcpt --silent 3 -t'
43 g3 0 /home/jj33 > vrfy firstname.lastname@example.org
44 g3 24 /home/jj33 > vrfy email@example.com
45 g3 0 /home/jj33 >
47 As you can see by the $? output, proj-foobar is not a valid address and
48 proj-swaks is.
50 This works well if you use $? in your command prompt, but if not it is
51 less useful. Also, it loses potentially useful information the mail
52 server might provide when rejecting an address. To get around this, try
53 using --silent 2, which prints only errors. Now you can expect no output
54 to mean the mail was valid, and any other output to mean an error
57 g3 0 /home/jj33 > PS1=$HOST' $PWD > '
58 g3 /home/jj33 > alias vrfy='swaks -q rcpt --silent 2 -t'
59 g3 /home/jj33 > vrfy firstname.lastname@example.org
60 <** 550 <email@example.com>: Recipient address rejected: User unknown in virtual alias table
61 g3 /home/jj33 > vrfy firstname.lastname@example.org
62 g3 /home/jj33 >
64 Stress-testing an SMTP server
65 I've received a couple of different requests and a couple of different
66 patches over the years to add functionality to have Swaks fork and send
67 a bunch of emails to a single address. I may still add this
68 functionality some day, but I still feel pretty strongly that ultimately
69 Swaks core is a single transaction. Forking multiple Swaks seems just
70 outside the scope of the tool.
72 However, this does seem to be something people want to do. To that end,
73 here is a quick-and-dirty shell script that is (almost) a drop in
74 replacement for Swaks: