Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: exim: dev

Small expect script for testing

 

 

exim dev RSS feed   Index | Next | Previous | View Threaded


tlyons at ivenue

Jun 26, 2013, 2:26 PM

Post #1 of 2 (80 views)
Permalink
Small expect script for testing

Frequently I find myself in the need of testing some exim code that
I'm working on, or testing some code that someone else is having
trouble with. The ability to quickly throw some content at an 'exim
-bh' instance is frequently useful for this testing. Here is a small
expect script which can quickly and easily provide this interaction.
IMHO it's useful for both admins working on their exim configuration
as well as devs working on code. By default it will generate a super
short test message (ala swaks) to pass to exim, or you can tell it to
use a text file that contains the headers and message body.

Usage:
./bh.exp mailserver env_from_address env_to_address [ body_text_file ]

Examples:
./bh.exp 64.14.201.8 tlyons [at] ivenue you [at] example
./bh.exp 64.14.201.8 tlyons [at] ivenue you [at] example /tmp/1.eml

I'll attach the expect script first, but if the list strips them, I'll
reply and put it in the message body.

Let me know if anybody finds this useful.

...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine
Attachments: bh.exp (1.62 KB)


tlyons at ivenue

Jun 26, 2013, 9:19 PM

Post #2 of 2 (72 views)
Permalink
Re: Small expect script for testing [In reply to]

On Wed, Jun 26, 2013 at 6:02 PM, John Jetmore <jj33 [at] pobox> wrote:
>> Examples:
>> ./bh.exp 64.14.201.8 tlyons [at] ivenue you [at] example
>> ./bh.exp 64.14.201.8 tlyons [at] ivenue you [at] example /tmp/1.eml

With permission, bringing this conversation back onto the Exim mailing
lists. (Kinda not) sorry for the cross-posts.

> Ordinarily I would have checked this out and let it slip by because
> heterogeneous toolsets are useful (see also Tony Finch's smtpc), but
> since you specifically mention swaks, I wanted to ask why you wrote
> something in expect that doesn't seem to do more than swaks does,
> except possibly provide a simple command line for the task at hand.

Providing a simple commandline for the task at hand was the goal, yes.
I got tired of copying and pasting SMTP conversation arguments to
test things.

> Specifically, the --pipe argument to swaks allows you access to all of
> swaks' normal options (tls, authentication, etc) via a spawned pipe
> instead of a inet socket. Your two example command lines would be
> written like this:
>
> swaks --pipe '/usr/sbin/exim -bh 64.14.201.8' -f tlyons [at] ivenue -t
> you [at] example
> swaks --pipe '/usr/sbin/exim -bh 64.14.201.8' -f tlyons [at] ivenue -t
> you [at] example --data /tmp/1.eml
>
> If you didn't know about --pipe, I hope this is useful. If you did

Very much so! I did not know about --pipe, and I did not know about
--data either (I simply had not looked beyond the simple uses I had
performed in the past). So to be perfectly clear, swaks already does
EXACTLY what I spent time constructing with expect. And I assume that
swaks, if it receives a 4xx or 5xx at the EHLO, MAIL, or RCPT stages,
will detect it and exit the smtp conversation at that point. I'll
test to make sure.

> know about --pipe but chose not to use it because it was deficient
> somehow, I'd love to hear details - always looking for ways to make
> swaks better. If you just felt like writing a script, please feel
> free to tell me to mind my own business!

It was simply a lack of awareness of swaks capabilities on my part.
Now that I know, I will use that instead :-) Thanks John!

...Todd
--
The total budget at all receivers for solving senders' problems is $0.
If you want them to accept your mail and manage it the way you want,
send it the way the spec says to. --John Levine

--
## List details at https://lists.exim.org/mailman/listinfo/exim-dev Exim details at http://www.exim.org/ ##

exim dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.