Discussion:
Blat doesn't finish
(too old to reply)
yuri.nater
2006-09-20 19:33:55 UTC
Permalink
I'm running blat in a batch file. I'm mailing 4 word documents.
Unless I press ^Z, blat doesn't finish. I've left the batch running 30
minutes, and I've done the ^Z after 30 seconds. the files are exactly
the same.

Any clue?

Here's the text of my batch file:
cd c:\flippersnap
blat -atf Freak.txt -tf Email.lst -s "Here's are your freakin' reports"
--
Homepage:
http://www.blat.net
Chip
2006-09-21 01:13:45 UTC
Permalink
Post by yuri.nater
I'm running blat in a batch file. I'm mailing 4 word documents.
Unless I press ^Z, blat doesn't finish. I've left the batch running 30
minutes, and I've done the ^Z after 30 seconds. the files are exactly
the same.
Any clue?
cd c:\flippersnap
blat -atf Freak.txt -tf Email.lst -s "Here's are your freakin' reports"
You have not told Blat what to use for the message body. What you did tell
it is the subject line, who to send an email to, and which files to attach,
but you have not said what should be in the message body itself. Try this
command line instead, removing line breaks so it is all on one line:

blat -
-body "Please see the attached reports.||Thanks"
-atf Freak.txt
-tf Email.lst
-s "Here's are your freakin' reports"

Please notice the first hyphen, and the -body option. These tell Blat what
your email message should read. The two vertical bars are to insert
carriage returns into the message so you will see a blank line just above
the word "Thanks" in the received email.
--
Chip
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-21 11:35:51 UTC
Permalink
Coooool!

That so totally worked. Thanks!! I hurt my brain trying to figure out
why it wouldn't send.

Thanks again,

Yuri
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-21 18:54:38 UTC
Permalink
So I have Blat sending the files. Now I want add a hyperlink to a Web
page. When I want to mail the reports, all I have to do is click the
link.

I've tried every way I can think of, but when I click the link, Blat
wants to run from *my* computer. Here's the error I get:

C:\Documents and Settings\<User Name>\Desktop>blat -body "The Windows
server reports are attached for your viewing pleasure.|| Enjoy." -atf
ServerList4.txt -tf Mail ToServerList4.txt -s "Windows Server Reports
for Today"
'blat' is not recognized as an internal or external command,
operable program or batch file.

I've tried different variations of <a
href="File://<Server>/Monitoring/ECDB/reports/Blat.Bat">, but nothing
works. It always wants to run from my computer or I get a page not
found error.
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-21 18:52:52 UTC
Permalink
So I have Blat sending the files. Now I want add a hyperlink to a Web
page. When I want to send the reports (in theory), all I have to do is
click the link.

I've tried every way I can think of, but when I click the link, Blat
wants to run from *my* computer. Here's the error I get:

C:\Documents and Settings\<User Name>\Desktop>blat -body "The Windows
server reports are attached for your viewing pleasure.|| Enjoy." -atf
ServerList4.txt -tf Mail ToServerList4.txt -s "Windows Server Reports
for Today"
'blat' is not recognized as an internal or external command,
operable program or batch file.

I've tried different variations of <a
href="File://<Server>/Monitoring/ECDB/reports/Blat.Bat">, but nothing
works. It always wants to run from my computer or I get a page not
found error.
--
Homepage:
http://www.blat.net
Tim Musson
2006-09-22 11:30:44 UTC
Permalink
Hey yuri.nater,

On Thursday, September 21, 2006 at 2:52:52 PM you wrote

yn> So I have Blat sending the files. Now I want add a hyperlink to a Web
yn> page. When I want to send the reports (in theory), all I have to do is
yn> click the link.

yn> I've tried every way I can think of, but when I click the link, Blat
yn> wants to run from *my* computer. Here's the error I get:

yn> C:\Documents and Settings\<User Name>\Desktop>blat -body "The Windows
yn> server reports are attached for your viewing pleasure.|| Enjoy." -atf
yn> ServerList4.txt -tf Mail ToServerList4.txt -s "Windows Server Reports
yn> for Today"
yn> 'blat' is not recognized as an internal or external command,
yn> operable program or batch file.

yn> I've tried different variations of <a
yn> href="File://<Server>/Monitoring/ECDB/reports/Blat.Bat">, but nothing
yn> works. It always wants to run from my computer or I get a page not
yn> found error.

What you are trying to do sounds like Blat's CGI function. Did you
look at the docs\cgi directory that came with your Blat distro?
--
Tim Musson
Flying with The Bat! eMail v2.12.00
The easiest way to find something lost around the house is to buy a
replacement.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-22 19:54:14 UTC
Permalink
Yikes!! That looks like it could be ugly.

**Your HTTP request must contain ##some## vars with the command line.
Which ones? Would the To, CC & BCC be those in the "GET example
using a FORM"?

**Would "Call from Web server
http://server/cgi-bin/blat.exe/Relative/WebPath/LineCommand.txt?
Message_Body" translate to
this? http://<computer>/cgi-bin/blat.exe/blatfiles/blat.txt

Anything else I should know?
Post by Tim Musson
Hey yuri.nater,
yn> So I have Blat sending the files. Now I want add a hyperlink to a Web
yn> page. When I want to send the reports (in theory), all I have to do is
yn> click the link.
yn> I've tried every way I can think of, but when I click the link, Blat
yn> C:\Documents and Settings\<User Name>\Desktop>blat -body "The Windows
yn> server reports are attached for your viewing pleasure.||
Enjoy." -atf
Post by Tim Musson
yn> ServerList4.txt -tf Mail ToServerList4.txt -s "Windows Server Reports
yn> for Today"
yn> 'blat' is not recognized as an internal or external command,
yn> operable program or batch file.
yn> I've tried different variations of <a
yn> href="File://<Server>/Monitoring/ECDB/reports/Blat.Bat">, but nothing
yn> works. It always wants to run from my computer or I get a page not
yn> found error.
What you are trying to do sounds like Blat's CGI function. Did you
look at the docs\cgi directory that came with your Blat distro?
--
Tim Musson
Flying with The Bat! eMail v2.12.00
The easiest way to find something lost around the house is to buy a
replacement.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
namtog
2006-09-22 22:59:34 UTC
Permalink
Greetings Yuri,

You wrote;
"Yikes!! That looks like it could be ugly."
Ugly web pages, that's right up my alley.

Then you wrote;
"Anything else I should know?"
Oh my. Where to begin? CGI most often, in
Namtog land, refers to Perl.
http://www.perl.com/

Here is a good Perl CGI tutorial;
http://www.cgi101.com/book/

You wrote that you want to send Windows Server
logs. This might be a problem, I don't write
for Windows Server . Rather I use the Apache web server.
http://www.apache.org/

The below is a simple example to send email from
a web page. If you want you can download this and
more from Namtog's Blat Install;
http://nbi.namtog.com/
or
http://geocities.com/namtog/blat_install.htm
Download the NBI_WIN.exe version

This example will not send attachments, more on that
in a minute.

#!perl -w

use strict;
use CGI;
use CGI::Carp 'fatalsToBrowser';
use CGI qw/:standard/;

###################globals
my $query;
my $mail_program;
my $form;
my $path_info;
###################globals

# Below is the location of Blat
# If Blat is in the same directory all you need is it's name: Blat

$mail_program = "blat"; #location of blat change if needed

# Above is the location of Blat, this is the biggest problem most have.

$query=new CGI;
# below is a little security bit
my $script_name=$query->script_name;
my $path_info=$query->path_info;
# above is a little security bit
print $query->header;
print $query->start_html (
-title=>"Blatmail test page",
-bgcolor=>"#cccccc");
# this lets the form find the sub sendemail
&sendemail() if ($path_info eq '/sendemail');

{

print<<EOF;
Use this page for a simple send email form
<br>
Check with the Blat docs if you want to add fields.
<br>


<form method="post" action="$script_name/sendemail">
<table border="0" width="450">
<tr>
<td width="47%" align="right">To email address:</td>
<td width="137%">
<input type="text" name="to" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">From email address:</td>
<td width="137%">
<input type="text" name="from" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">Subject:</td>
<td width="137%">
<input type="text" name="subject" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">Message:</td>
<td width="137%">
<textarea name="message" rows="5" cols="39"></textarea>
</tr>
<tr>
<td width="47%" align="right">&nbsp;</td>
<td width="137%">&nbsp;
</tr>
<tr>
<td colspan="2" align="right">
<div align="center">
<input type="submit" value="Send Email">
<input type="reset" value="Reset" >
</div>
</td>
</tr>
</table>
<p>&nbsp;</p>
</form>

EOF
;

}

# Send email ()
# Takes:
# (To, From, Subject, Message)
sub sendemail {
my $to;
my $from;
my $subject;
my $message;
my $blat_string;

#print $query->param; #use this to test blat input
$form = new CGI;
$to=$form->param('to');
$from=$form->param('from');
$subject=$form->param('subject');
$message=$form->param('message');
$mail_program =~ s/\//\\/g;
$blat_string = "- -t $to -i $from -s \"$subject\" -body \"$message\"
-q ";
# in the line above take out the -q to read
# blat output after you send email
system ("$mail_program", "$blat_string");


}

Now after you get the above or something like it to
work you will want to add/delete some of the fields.


You also want to send Freak.txt. Blat has CGI limitations
that will normally prevent you from doing this. There is
a work around. Rick's Blat Bypass;
http://rbb.namtog.com/
or
http://geocities.com/namtog/rbb.htm

Remember to first get your web form to send email before
you try this.

You could also build the entire web page in Perl and then
not use Blat at all. For a example check the source of NBI
for the Test Email Server section. It will take you up
to the connection to server. The rest you will have to add.
See this page for more info;
http://www.networksorcery.com/enp/protocol/smtp.htm

Or you could try another command line email tool;
http://www.google.com/search?hl=en&q=command+line+email&btnG=Google+Search

Remember, if Namtog can do it any one can,
Namtog
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-23 15:07:14 UTC
Permalink
Thanks, Namtog. Are you sure "if Namtog can do it any one can"?

Your website has some great info. I've downloaded and extracted
Build-It & Write-It, but I can't find where to download
NBI_WIN.exe. I already have Blat installed, and it works.

I have *very* limited programming skills. I know a *little* about
perl. I have Perl for Win32 installed, and I have been able to run
a couple simple scripts from my cgi-bin directory.

I don't want to get too side-tracked. My ultimate goal is to have
my windows server send my reports with the click of a button. On a
side-note, for the **LONGEST** time, I've wanted to have a submit
form on my (non-work related) Web site so people can send messages,
feedback or files to me. Will your Perl script help me with that?

Here's a bit on my background. I'm a Windows Admin, working on my
MCSE. I have, as I said, next to NO programming experience.
Scripting/programming has been my career's Achilles tendon. I can
write batch files and simplistic VB scripts, and I've dabbled in
Perl. I've been trying to learn some scripting language, but I
always seem to get side-tracked (stupid ADD!) or frustrated and give
up. I guess my point is that I am technical, just not when it comes
to scripting. If you wouldn't mind, when you write things like

###################globals
Post by namtog
my $query;
my $mail_program;
my $form;
my $path_info;
###################globals
Could you write in examples or definitions? I *hope* I'm not asking
too much, but I'm too close to quit now.

My path to Perl is "PATH=C:\Perl\bin\" It's in my Win32 directory,
so it's in the path.
For mail prog =, can I use "$mail_program = "blat";

For my next rookie question, since I don't use Sendmail, what might
I put in this line?
"<form method="post" action="$script_name/sendemail">" and where do
I put "script_name" or what is it? I can get the form to come up,
but when I click submit, I get a page can't be found error.

"Remember to first get your web form to send email before you try
this." This is where I'm stuck. My website is in a folder
called "monitoring." Blat.exe is also in that folder.
Post by namtog
Greetings Yuri,
You wrote;
"Yikes!! That looks like it could be ugly."
Ugly web pages, that's right up my alley.
Then you wrote;
"Anything else I should know?"
Oh my. Where to begin? CGI most often, in
Namtog land, refers to Perl.
http://www.perl.com/
Here is a good Perl CGI tutorial;
http://www.cgi101.com/book/
You wrote that you want to send Windows Server
logs. This might be a problem, I don't write
for Windows Server . Rather I use the Apache web server.
http://www.apache.org/
The below is a simple example to send email from
a web page. If you want you can download this and
more from Namtog's Blat Install;
http://nbi.namtog.com/
or
http://geocities.com/namtog/blat_install.htm
Download the NBI_WIN.exe version
This example will not send attachments, more on that
in a minute.
#!perl -w
use strict;
use CGI;
use CGI::Carp 'fatalsToBrowser';
use CGI qw/:standard/;
###################globals
my $query;
my $mail_program;
my $form;
my $path_info;
###################globals
# Below is the location of Blat
# If Blat is in the same directory all you need is it's name: Blat
$mail_program = "blat"; #location of blat change if needed
# Above is the location of Blat, this is the biggest problem most have.
$query=new CGI;
# below is a little security bit
my $script_name=$query->script_name;
my $path_info=$query->path_info;
# above is a little security bit
print $query->header;
print $query->start_html (
-title=>"Blatmail test page",
-bgcolor=>"#cccccc");
# this lets the form find the sub sendemail
&sendemail() if ($path_info eq '/sendemail');
{
print<<EOF;
Use this page for a simple send email form
<br>
Check with the Blat docs if you want to add fields.
<br>
<form method="post" action="$script_name/sendemail">
<table border="0" width="450">
<tr>
<td width="47%" align="right">To email address:</td>
<td width="137%">
<input type="text" name="to" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">From email address:</td>
<td width="137%">
<input type="text" name="from" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">Subject:</td>
<td width="137%">
<input type="text" name="subject" size="51">
</td>
</tr>
<tr>
<td width="47%" align="right">Message:</td>
<td width="137%">
<textarea name="message" rows="5" cols="39"></textarea>
</tr>
<tr>
<td width="47%" align="right">&nbsp;</td>
<td width="137%">&nbsp;
</tr>
<tr>
<td colspan="2" align="right">
<div align="center">
<input type="submit" value="Send Email">
<input type="reset" value="Reset" >
</div>
</td>
</tr>
</table>
<p>&nbsp;</p>
</form>
EOF
;
}
# Send email ()
# (To, From, Subject, Message)
sub sendemail {
my $to;
my $from;
my $subject;
my $message;
my $blat_string;
#print $query->param; #use this to test blat input
$form = new CGI;
$to=$form->param('to');
$from=$form->param('from');
$subject=$form->param('subject');
$message=$form->param('message');
$mail_program =~ s/\//\\/g;
$blat_string = "- -t $to -i $from -s \"$subject\" -body
\"$message\"
Post by namtog
-q ";
# in the line above take out the -q to read
# blat output after you send email
system ("$mail_program", "$blat_string");
}
Now after you get the above or something like it to
work you will want to add/delete some of the fields.
You also want to send Freak.txt. Blat has CGI limitations
that will normally prevent you from doing this. There is
a work around. Rick's Blat Bypass;
http://rbb.namtog.com/
or
http://geocities.com/namtog/rbb.htm
Remember to first get your web form to send email before
you try this.
You could also build the entire web page in Perl and then
not use Blat at all. For a example check the source of NBI
for the Test Email Server section. It will take you up
to the connection to server. The rest you will have to add.
See this page for more info;
http://www.networksorcery.com/enp/protocol/smtp.htm
Or you could try another command line email tool;
http://www.google.com/search?
hl=en&q=command+line+email&btnG=Google+Search
Post by namtog
Remember, if Namtog can do it any one can,
Namtog
--
Homepage:
http://www.blat.net
Tim Musson
2006-09-24 01:55:28 UTC
Permalink
Hey yuri.nater,

On Saturday, September 23, 2006 at 11:07:14 AM you wrote

yn> I have *very* limited programming skills. I know a *little* about
yn> perl. I have Perl for Win32 installed, and I have been able to run
yn> a couple simple scripts from my cgi-bin directory.

yn> I don't want to get too side-tracked. My ultimate goal is to have
yn> my windows server send my reports with the click of a button.

Hmmm, why not schedule it to send them every day, or 12h or something
like that? then you don't need to open a browser, and click a link...

yn> On a side-note, for the **LONGEST** time, I've wanted to have a
yn> submit form on my (non-work related) Web site so people can send
yn> messages, feedback or files to me. Will your Perl script help me
yn> with that?

One of the easiest is FormMail.pl written for the unix world (not very
secure or well written code btw). However, here my standard boiler
plate for formmail... Yes, it takes you away from Blat CGI, but... :)

formmail.pl from "Matt's Script Archive" runs only on Unix
and uses sendmail. Someone then modified it to run on Win32
(I can't recall the exact link) and use Blat. However,
formmail.pl has been re-written to clean it up, etc and now
no longer uses Blat, it sends with native Perl modules.
Look here http://nms-cgi.sourceforge.net/ for the formmail.pl
I suggest you use.

yn> Here's a bit on my background. I'm a Windows Admin, working on my
yn> MCSE.

Ah, now we get to it. Personally I have avoided any thing MS related
as much as I can. Not an easy task. However, if you are entering the
field, it isn't a bad cert to get - very employable.

yn> I have, as I said, next to NO programming experience.
yn> Scripting/programming has been my career's Achilles tendon.

I work with a number of MCSE's and I am continuously amazed at the
lack of automation skills. Personally I would think that it should be
one of the top requirements. If I have to do a task more that about 3
times, I always spend the time to automate it.

I can't stand the GUI interface, and am always on the lookout for
command line tools. They are typically much faster. For example, I
just deleted 175 empty DHCP scopes on 8 different servers.

It was about 30 min to dump the stats on all 600 scopes, extract which
were empty (all with a batch file). Then about 10 min to create a
batch file loop that would dump the config of each scope to be
deleted, then delete it. Then about 10 seconds to start the
backup/delete batch file. (yes, it ran an hour, but it would have
taken me 2 or 3 days to manually export the config then delete each
scope with the GUI.)

yn> I can write batch files and simplistic VB scripts, and I've
yn> dabbled in Perl. I've been trying to learn some scripting
yn> language, but I always seem to get side-tracked (stupid ADD!) or
yn> frustrated and give up. I guess my point is that I am technical,
yn> just not when it comes to scripting.

Ok, Suggestion time. Note, this is my personal opinion based on where
you appear to be heading in your career...

I would suggest you get good at VB Scripts. I only suggest this as
you are working on MCSE. I personally like Perl (and I know others
like other scripting languages like REXX, and on a side note, REXX
is a great language. IIRC it came from the IBM Mainframe world,
but runs from everyting - probably even your watch...) and can't
stand VB Script - mostly because I work in both the unix and
windows environments.

Another scripting language you should work on is batch. It is one
of the easiest to put all the various command lines you should be
using on a daily basis as an MCSE together.

One of my MCSE co-workers uses a GUI to write code (batch,
VBScript, Perl, etc.) and I will see if I can find out what it is.
I believe it is a free download from MS...

End of Suggestion... :)
--
Tim Musson
Flying with The Bat! eMail v2.12.00
They call it PMS because MadCow Disease was already taken.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
Tim Musson
2006-09-26 16:57:48 UTC
Permalink
Hey Tim,

On Saturday, September 23, 2006 at 9:55:28 PM you wrote

TM> One of my MCSE co-workers uses a GUI to write code (batch,
TM> VBScript, Perl, etc.) and I will see if I can find out what it is.
TM> I believe it is a free download from MS...

The tool I was thinking of is Scriptomatic and you can find it here
http://www.microsoft.com/technet/scriptcenter/createit.mspx
--
Tim Musson
Flying with The Bat! eMail v2.12.00
I smile! because I don't know what the hell is going on.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
Tim Musson
2006-09-24 02:08:45 UTC
Permalink
Hey yuri.nater,

On Friday, September 22, 2006 at 3:54:14 PM you wrote

yn> Yikes!! That looks like it could be ugly.

:) depends on what you call ugly. If you get it correct, it may look
like line noise, but be beautiful.

yn> **Your HTTP request must contain ##some## vars with the command
yn> line. Which ones? Would the To, CC & BCC be those in the "GET
yn> example using a FORM"?

yn> **Would "Call from Web server
yn> http://server/cgi-bin/blat.exe/Relative/WebPath/LineCommand.txt?
yn> Message_Body" translate to this?
yn> http://<computer>/cgi-bin/blat.exe/blatfiles/blat.txt

Sure. As long as /blatfiles is in the root of the web server, and
blat.txt lives in that directory. Then blat.txt would need to include
all the command line options you would run from a command prompt
running on the web server. Don't forget to include ?Msg_Boyd on the
end, I don't recall right now if it is required (it's been a couple of
years since I wrote that html file, and a number of months since I
played with Blat like this...), but I *know* it works if it is there.

I do have a set of test files zipped up that includes a tiny web
server (called TINY.exe LOL), a small SMTP local server and all the
files to play with using Blat in CGI. If you are interested, I can
post it somewhere (it will take me a couple of hours to make sure it
is in a post-able shape though).

yn> Anything else I should know?

LOL, lots. What you are looking to do is mesh html syntax, Blat
syntax and CGI...

It is also going to depend on what web server you are running and how
you have it's security set.
--
Tim Musson
Flying with The Bat! eMail v2.12.00
The days of the digital watch are numbered.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
namtog
2006-09-24 17:47:56 UTC
Permalink
Greetings,

Yuri wrote;
"Thanks, Namtog. Are you sure "if Namtog
can do it any one can"?"
Yes. A theorem my 3rd wife repeatedly and
conclusively proved during our divorce.

Then yuri said;
"but I can't find where to download
NBI_WIN.exe. I already have Blat installed,
and it works."
That's because you didn't scroll down the page
far enough. Here are direct links;
http://333-emachine.servemp3.com/html/download/blat_install_WIN.zip
or
http://geocities.com/namtog/blat_install_WIN.zip
Now you will have a copy of blatmail.pl that is formatted
correctly.

That you have Blat installed and it works is
way cool. Your ahead of the curve.

So at this point I'm gonna assume you have d/l
and installed NBI. You have two new icons on your
desktop. Double click NBI. This will start a custom
browser control and the Apache web server.

Select Blat mail.

Since you have Blat installed feel free to send
yourself or anyone you like a small email or two.
Make sure your fire wall and any anti virus program are set
to allow this new location for Blat.

Then click on;
Text version of blatmail.pl
Then copy and save it. Name it anything you like.
If you place it in the same folder as Blat,
say in your CGI folder, you won't have to make
any changes. It probably WON'T work in a MS Windows
server. I don't write for Windows server, instead
I use Apache.

If everything works so far you can continue.
Notice there are four fields;
To email address:
From email address:
Subject:
Message:
These are all that Blat allows when called as a
CGI. In the Blat source (Blat 2.50) on line 275 of
blatcgi.cpp you will find;
* If .szCgiEntry == 1, then the option is blocked from CGI access.
The other Blat options are blocked.
On line 308 you will find;
(*(lpszValue.Get()+i)) = '\''; // to avoid security problem,
like including other parameter like -attach

To get past this restriction, so you can use
-atf ServerList4.txt
you will need to use Rick's Blat Bypass (RBB).
http://rbb.namtog.com/
or
http://geocities.com/namtog/rbb.htm

Since your want to send the same info each time that is in
the variable fields of blatmail.pl you can delete them and the
corresponding sub sendmail functions. Only the send button
will remain on the web page.

Now you call RBB instead of Blat.exe.
As example, in the file of.txt you would write each of
the below on a separate line;
-body "The Windows server reports are attached for your viewing
pleasure.||Enjoy."
-atf ServerList4.txt
-tf MailToServerList4.txt
-s "Windows Server Reports"

That should be it.

If you have no further use for NBI you can delete it the same
as any other program.

Namtog
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-26 19:11:38 UTC
Permalink
You have the patience of a saint, Namtog.

Here's where I am: when I open a browser and type
http://<ComputerName>/cgi-bin/test.pl, I get a nice HTML page (the
text of which is below)

Text version of blatmail.pl
Use this page for a simple send email form
Check with the Blat docs if you want to add fields.

To email address:
From email address:
Subject:
Message: test

When I fill out the info anc click send I get "The page cannot be
displayed."

This is my problem. I'm not sure where to put the path to blat.
Would it be like this:
$mail_program = "blat"; C:\Monitoring\cgi-bin\blat.exe #location of
blat change if needed?

When I add that text, I get an error message.

Also, when "The page cannot be displayed" error is displayed, the URL
in my browser is http://<ComputerName>/cgi-bin/test.pl/sendemail.

So If I'm using SMTP, which lines would I edit, if any?

In my limited exposure, I think there has to be some sort
of "handler" to answer the form request, right? Is this what I'm
missing? When I send mail from your NBI, it works like a champ. No
matter *what* I do to <form method="post"
action="$script_name/sendemail">, I can't get anything to send. I
know Sendmail is a *nix prog. Might I put the address of my mail
server?
Post by namtog
Greetings,
Yuri wrote;
"Thanks, Namtog. Are you sure "if Namtog
can do it any one can"?"
Yes. A theorem my 3rd wife repeatedly and
conclusively proved during our divorce.
Then yuri said;
"but I can't find where to download
NBI_WIN.exe. I already have Blat installed,
and it works."
That's because you didn't scroll down the page
far enough. Here are direct links;
http://333-emachine.servemp3.com/html/download/blat_install_WIN.zip
or
http://geocities.com/namtog/blat_install_WIN.zip
Now you will have a copy of blatmail.pl that is formatted
correctly.
That you have Blat installed and it works is
way cool. Your ahead of the curve.
So at this point I'm gonna assume you have d/l
and installed NBI. You have two new icons on your
desktop. Double click NBI. This will start a custom
browser control and the Apache web server.
Select Blat mail.
Since you have Blat installed feel free to send
yourself or anyone you like a small email or two.
Make sure your fire wall and any anti virus program are set
to allow this new location for Blat.
Then click on;
Text version of blatmail.pl
Then copy and save it. Name it anything you like.
If you place it in the same folder as Blat,
say in your CGI folder, you won't have to make
any changes. It probably WON'T work in a MS Windows
server. I don't write for Windows server, instead
I use Apache.
If everything works so far you can continue.
Notice there are four fields;
These are all that Blat allows when called as a
CGI. In the Blat source (Blat 2.50) on line 275 of
blatcgi.cpp you will find;
* If .szCgiEntry == 1, then the option is blocked from CGI access.
The other Blat options are blocked.
On line 308 you will find;
(*(lpszValue.Get()+i)) = '\''; // to avoid security problem,
like including other parameter like -attach
To get past this restriction, so you can use
-atf ServerList4.txt
you will need to use Rick's Blat Bypass (RBB).
http://rbb.namtog.com/
or
http://geocities.com/namtog/rbb.htm
Since your want to send the same info each time that is in
the variable fields of blatmail.pl you can delete them and the
corresponding sub sendmail functions. Only the send button
will remain on the web page.
Now you call RBB instead of Blat.exe.
As example, in the file of.txt you would write each of
the below on a separate line;
-body "The Windows server reports are attached for your viewing
pleasure.||Enjoy."
-atf ServerList4.txt
-tf MailToServerList4.txt
-s "Windows Server Reports"
That should be it.
If you have no further use for NBI you can delete it the same
as any other program.
Namtog
--
Homepage:
http://www.blat.net
namtog
2006-09-27 11:21:57 UTC
Permalink
Greetings,

Yuri wrote;
"This is my problem. I'm not sure where to put the path to blat.
Would it be like this:
$mail_program = "blat"; C:\Monitoring\cgi-bin\blat.exe #location of
blat change if needed?"

If Blat or a copy of it is in the same folder as
test.pl you could use the following;

$mail_program = "blat";
or
$mail_program = "blat.exe";
or
$mail_program = C:\Monitoring\cgi-bin\blat.exe ;

Don't forget that all most all lines in Perl end
with a semicolon ;

The pound symbol # is for a comment.

Next yuri wrote;
"So If I'm using SMTP, which lines would I edit, if any?"
Blat handles the SMTP stuff, you don't need to edit
anything at this point.

The only two things you would have to change in the script
are the shebang line and $mail_program. Shebang already works
for you, otherwise you wouldn't see the web page at all.

Finally yuri said;
"When I send mail from your NBI, it works like a champ."
That demonstrates Blat is functioning correctly. Now you
have the same work ahead of you we all have had. Getting
Blat to do what you want.

Namtog
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-27 17:58:48 UTC
Permalink
I'm getting closer, but I'm still missing something.
Let me ask a couple dumb questions:
1. Is a form that has a submit button (or similar) a two-part
operation? In-other-words, if I have Namtog's form saved as test.pl,
and I open it in a browser (and it does open and looks good), when I
click on "Send Email", doesn't it open (or contact or call or
whatever -I'm not sure the verbage) another page or form? I think
that may be why I'm getting "http://<Name>/cgi-bin/test.pl/sendemail"
returned in my browser instead of the proper result.
2. If that's the case, what form do I use to answer the "Send Email"
request?

I've been messing around, and I found some perl script that has two
parts. a front end you fill out and a back end you get when you
click "Send Email". It *still* doesn't work, but at least I don't
get a page not found. this is the line in the html <form action="/cgi-
bin/mailtest.pl" method="post" > I *should* get an e-mail, but I
only get "message.txt -s "test" -t "***@Domain.com" -server
mail.Domain.com -f "***@Domain.com"Done.Mail sent to
***@Domain.com," which is what I put in the form.

I'm **SOOO** confused.....
Post by namtog
Greetings,
Yuri wrote;
"This is my problem. I'm not sure where to put the path to blat.
$mail_program = "blat"; C:\Monitoring\cgi-bin\blat.exe #location of
blat change if needed?"
If Blat or a copy of it is in the same folder as
test.pl you could use the following;
$mail_program = "blat";
or
$mail_program = "blat.exe";
or
$mail_program = C:\Monitoring\cgi-bin\blat.exe ;
Don't forget that all most all lines in Perl end
with a semicolon ;
The pound symbol # is for a comment.
Next yuri wrote;
"So If I'm using SMTP, which lines would I edit, if any?"
Blat handles the SMTP stuff, you don't need to edit
anything at this point.
The only two things you would have to change in the script
are the shebang line and $mail_program. Shebang already works
for you, otherwise you wouldn't see the web page at all.
Finally yuri said;
"When I send mail from your NBI, it works like a champ."
That demonstrates Blat is functioning correctly. Now you
have the same work ahead of you we all have had. Getting
Blat to do what you want.
Namtog
--
Homepage:
http://www.blat.net
namtog
2006-09-27 20:21:12 UTC
Permalink
Greetings,

Yuri wrote;
"I'm getting closer, but I'm still missing something.
Let me ask a couple dumb questions:
1. Is a form that has a submit button (or similar) a two-part
operation? In-other-words, if I have Namtog's form saved as test.pl,
and I open it in a browser (and it does open and looks good), when I
click on "Send Email", doesn't it open (or contact or call or
whatever -I'm not sure the verbage) another page or form? I think
that may be why I'm getting "http://<Name>/cgi-bin/test.pl/sendemail"
returned in my browser instead of the proper result."

The result your getting http://<Name>/cgi-bin/test.pl/sendemail
is correct. That's the way this script works.

I've mentioned this before, I write for the Apache web server.
I suspect you are using something like Windows server 2003. It
is doubtfull my scripts will work on that platform.

This is no longer a Blat issue. I suggest you try
a Perl group;
http://tech.groups.yahoo.com/group/perl-beginner/

Namtog
--
Homepage:
http://www.blat.net
namtog
2006-09-24 17:56:11 UTC
Permalink
Greetings,

Tim wrote;
"I do have a set of test files zipped up that includes a tiny web
server (called TINY.exe LOL), a small SMTP local server and all the
files to play with using Blat in CGI. If you are interested, I can
post it somewhere (it will take me a couple of hours to make sure it
is in a post-able shape though)."

Hey Tim. How about posting Tim's Blat Sandbox here;
http://tech.groups.yahoo.com/group/blat/files/Other/
There is about 15MB of space left.

Namtog
--
Homepage:
http://www.blat.net
yuri.nater
2006-09-26 20:00:11 UTC
Permalink
Thanks, Tim.

At this point, I'll try anything.
Post by Tim Musson
Hey yuri.nater,
yn> Yikes!! That looks like it could be ugly.
:) depends on what you call ugly. If you get it correct, it may look
like line noise, but be beautiful.
yn> **Your HTTP request must contain ##some## vars with the command
yn> line. Which ones? Would the To, CC & BCC be those in the "GET
yn> example using a FORM"?
yn> **Would "Call from Web server
yn> http://server/cgi-bin/blat.exe/Relative/WebPath/LineCommand.txt?
yn> Message_Body" translate to this?
yn> http://<computer>/cgi-bin/blat.exe/blatfiles/blat.txt
Sure. As long as /blatfiles is in the root of the web server, and
blat.txt lives in that directory. Then blat.txt would need to
include
Post by Tim Musson
all the command line options you would run from a command prompt
running on the web server. Don't forget to include ?Msg_Boyd on the
end, I don't recall right now if it is required (it's been a couple of
years since I wrote that html file, and a number of months since I
played with Blat like this...), but I *know* it works if it is
there.
Post by Tim Musson
I do have a set of test files zipped up that includes a tiny web
server (called TINY.exe LOL), a small SMTP local server and all the
files to play with using Blat in CGI. If you are interested, I can
post it somewhere (it will take me a couple of hours to make sure it
is in a post-able shape though).
yn> Anything else I should know?
LOL, lots. What you are looking to do is mesh html syntax, Blat
syntax and CGI...
It is also going to depend on what web server you are running and how
you have it's security set.
--
Tim Musson
Flying with The Bat! eMail v2.12.00
The days of the digital watch are numbered.
Blat Manager, current version is 2.5, see www.blat.net
--
Homepage:
http://www.blat.net
Hamilton, Robert L
2006-09-23 15:45:23 UTC
Permalink
Yuri,

Get a copy of REXX. It comes in several flavors and runs on all
computers that I know of- From the biggest mainframes to the smallest PC
things and hand - helds. A version of it is written in C so all you need
is a C compiler if your computer doesn't have a version all ready. It's
easy to run as CGI on Apache and it is simple to run BLAT - or any EXE
-- from a REXX pgm; I run 100K/week of HTML emails from a 5 line REXX.
One version is on sourceforge.net. If you need help, there is REXX
Language Association and a list at ***@lists.psu.edu. I'm at
***@alumni.ou.edu or ***@utdallas.edu

ROTFLMAO - yure-nator, are you sure?

bobh
--
Homepage:
http://www.blat.net
Continue reading on narkive:
Loading...