Example SMTP Scripts
Topic Last Modified: 2007-01-24
The following SMTP commands are described in RFC 821 (see http://www.ietf.org):
HELO EHLO QUIT DATA BDAT MAIL RCPT AUTH STARTTLS VRFY RSET
The following script commands are defined by this module:
CONNECT Attempts to establish an SMTP socket connection.
DATASTRING Indicates that the given argument should be interpreted as a literal string and transmitted (during the DATA command). Can be used to transmit message headers.
DATAFILE Indicates the given argument should be interpreted as the name of a file and that the contents of the file should be transmitted (during the DATA command).
DATAEND Indicates that all message contents have now been transmitted, and a response from the server is to be expected. An example is Scripts.
Send a message that has one recipient. The message body is in file body.txt. Sleep between 3 and 5 seconds afterward.
CONNECT EHLO MAIL FROM: <me> RCPT TO: someone@somewhere DATA body.txt QUIT SLEEP RANDNUMBER(3000, 5000)
|body.txt ends with CRLF.CRLF. You can also use BDAT instead of DATA.|
Send a message that has a random number of recipients. Each recipient has a random name and a random domain. Each message has a random body file.
CONNECT EHLO MAIL FROM: <me> LOOP RANDNUMBER(100, 1000) RCPT TO: rcptRANDNUMBER(1, 20)@RANDLIST(domains.txt) ENDLOOP DATA RANDLIST(bodies.txt) QUIT
Where: domains.txt contains the domains to chose from (one domain per line), and bodies.txt contains the file names to chose from (one line name per line).
Each file listed in bodies.txt ends with CRLF.CRLF. You can also use BDAT instead of DATA. Each recipient name is in the form: rcptX, where X is a number between 1 and 20.
Send a message that has headers generated programmatically.
CONNECT EHLO MAIL FROM: <me> RCPT TO: <you> DATA DATASTRING From: me\nTo: you\n DATASTRING Subject: test message #SEQUNUMBER(1, 100000, 10)\n DATASTRING X-MsgId: SAMESEQUNUMBER(1, 100000, 10)\n\n DATAFILE <chunk1.txt> DATAFILE <chunk2.txt> DATASTRING \n.\n ENDDATA QUIT
Neither chunk1.txt nor chunk2.txt contains the sequence CRLF.CRLF. In this example, the ending sequence is sent explicitly. BDAT does not support this format.