Here's a quiz...
How to use smtp with gawk. What works on the bash command line is not working in an awk script. Consider the following code:
BEGIN {
RS = ORS = "\r\n"
to = "name@server.com"
from = "name2@server.com"
text = "testing1...testing2...testing3..."
subject = "testing 1...2...3"
smtp = "mail.server.com"
connection = "/inet/tcp/0/"smtp"/25"
print "HELO "smtp |& connection; connection |& getline
print "MAIL FROM:<"from">" |& connection; connection |& getline
print "RCPT TO:<"to">" |& connection; connection |& getline
print "DATA" |& connection; connection |& getline
print "Subject: "subject"\n"text |& connection; connection |& getline
print "." |& smtp; connection |& getline
print "QUIT" |& connection; connection |& getline
close(connection);
}
The fix might be to correct the read of server messages after each print with the two-way pipe ability of |&
How to use smtp with gawk. What works on the bash command line is not working in an awk script. Consider the following code:
BEGIN {
RS = ORS = "\r\n"
to = "name@server.com"
from = "name2@server.com"
text = "testing1...testing2...testing3..."
subject = "testing 1...2...3"
smtp = "mail.server.com"
connection = "/inet/tcp/0/"smtp"/25"
print "HELO "smtp |& connection; connection |& getline
print "MAIL FROM:<"from">" |& connection; connection |& getline
print "RCPT TO:<"to">" |& connection; connection |& getline
print "DATA" |& connection; connection |& getline
print "Subject: "subject"\n"text |& connection; connection |& getline
print "." |& smtp; connection |& getline
print "QUIT" |& connection; connection |& getline
close(connection);
}
The fix might be to correct the read of server messages after each print with the two-way pipe ability of |&