Discussion:
using blat from a C++ Project
(too old to reply)
tim.cripps
2007-03-26 15:02:34 UTC
Permalink
I need to be able to send faxes from a C++ project where Outlook might
not be available. To do this I beieve I can send an e-mail using 'BLAT'
to our fax server where it will be passed into a process which handles
the e-mail as a fax message.
Therefore to begin with, I need to set up and send an e-mail using BLAT
from the C++ project.
I have to admit that I've got a bit lost looking through all the
documentation on this and if there is anyone who can help me at least
get started, I would be very grateful.

Tim
Chip
2007-03-26 23:57:31 UTC
Permalink
Post by tim.cripps
I need to be able to send faxes from a C++ project where Outlook might
not be available. To do this I beieve I can send an e-mail using 'BLAT'
to our fax server where it will be passed into a process which handles
the e-mail as a fax message.
Therefore to begin with, I need to set up and send an e-mail using BLAT
from the C++ project.
I have to admit that I've got a bit lost looking through all the
documentation on this and if there is anyone who can help me at least
get started, I would be very grateful.
Tim
It might be easiest to use blat.dll linked to your project. This means you
won't have to spawn() a copy of Blat each time you want to send something.
You also do not need to run "blat -install" prior to using the .dll, as long
as you provide the server and email credentials to the .dll. Here is a
simple C++ program to use the .dll:

--------
#include <windows.h>
#include <stdio.h>
// #include <stdlib.h>

#ifdef WIN32
#define __far far
#define huge far
#define __near near
#endif

HMODULE blat_lib = 0;

int (FAR PASCAL *blat_send) (char FAR *);


// loads the BLAT DLL file
int __cdecl load_blat()
{
blat_lib = LoadLibrary("blat.dll");
if ( blat_lib == NULL )
{
printf("Could not load BLAT.DLL\nInstall this in your path.");
return(-1);
}

blat_send = (int (FAR PASCAL *)(char FAR *))GetProcAddress(blat_lib,
"Send");
if ( blat_send == NULL )
{
printf("couldn't getprocaddress for blat_send\n");
return(-1);
}
return(0);
}


int __cdecl main( int argc, /* Number of strings in array argv */
char **argv, /* Array of command-line argument strings */
char **envp ) /* Array of environment variable strings */
{
int retval;

argc = argc;
argv = argv;
envp = envp;

retval = load_blat();
if ( retval )
return( retval );

retval = blat_send("C:\\config.sys " \
"-s \"testing blat.dll\" " \
"-p attmail " \
"-t myself " \
"-attach \"g:\\blatdll\\blatdll.cpp\" " \
"-superdebug " \
"-noh2 " \
"-log \"C:\\smtp.log\"");

(void)FreeLibrary( blat_lib );
return(retval);
}
--------

I just compiled and ran it here on my WinXP system. Note that I have
already installed my server parameters, so it was not necessary for me to
include them in this source code.
--
Chip
Cripps Tim
2007-03-27 09:37:28 UTC
Permalink
Chip
Thankyou very much for taking the time to reply to my query. I shall
have a go.
I hope you don't mind me just asking a couple of questions about the
blat installation before I commence.
I have included the comments from the DLL that are required for the
installation in green below with my queries in red beneath.
I fully understand if you think you have helped me enough and I do
appreciate your help.
// Dependencies: for the email functionality to work correctly

the system must meet several requirments.

1: the following registry keys must exist, these keys should be setup
during install setup.

[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat]

On checking the Registry with regedit, I see that there is currently no
"Public Domain" directory. Do I need to create it and then do I need to
download Blat to that directory?

"SMTP server"="xxx.yyy" //email server

Can you tell me how to find out the name of the email server? I'm not
sure what format "xxx.yyy" takes?

"Sender"="***@xxx.yyy" //machine sending email

Again, I'm not sure what format ***@xxx.yyy <mailto:***@xxx.yyy> takes.
Are you able to tell me how to find it?

"SMTP Port"="25" //email SMTP port

I'm not doing very well am I. Are you able to tell me how to find out
the SMTP Port?

"Try"="1" //number of times to rety sending email

2: Email address of the 'Admin' must be set in the registry, this key is
located in a sub dir

[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat] "Admin_Email"

and is a char

Can you tell me what the 'Admin' is used for and what is the sub dir
referred to above?

3: machine must have access to the internet



Again, many thanks for your help already

Tim


________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Chip
Sent: 27 March 2007 00:58
To: ***@yahoogroups.com
Subject: Re: [blat] using blat from a C++ Project
Post by tim.cripps
I need to be able to send faxes from a C++ project where Outlook might
not be available. To do this I beieve I can send an e-mail using 'BLAT'
to our fax server where it will be passed into a process which handles
the e-mail as a fax message.
Therefore to begin with, I need to set up and send an e-mail using BLAT
from the C++ project.
I have to admit that I've got a bit lost looking through all the
documentation on this and if there is anyone who can help me at least
get started, I would be very grateful.
Tim
It might be easiest to use blat.dll linked to your project. This means
you
won't have to spawn() a copy of Blat each time you want to send
something.
You also do not need to run "blat -install" prior to using the .dll, as
long
as you provide the server and email credentials to the .dll. Here is a
simple C++ program to use the .dll:

--------
#include <windows.h>
#include <stdio.h>
// #include <stdlib.h>

#ifdef WIN32
#define __far far
#define huge far
#define __near near
#endif

HMODULE blat_lib = 0;

int (FAR PASCAL *blat_send) (char FAR *);

// loads the BLAT DLL file
int __cdecl load_blat()
{
blat_lib = LoadLibrary("blat.dll");
if ( blat_lib == NULL )
{
printf("Could not load BLAT.DLL\nInstall this in your path.");
return(-1);
}

blat_send = (int (FAR PASCAL *)(char FAR *))GetProcAddress(blat_lib,
"Send");
if ( blat_send == NULL )
{
printf("couldn't getprocaddress for blat_send\n");
return(-1);
}
return(0);
}

int __cdecl main( int argc, /* Number of strings in array argv */
char **argv, /* Array of command-line argument strings */
char **envp ) /* Array of environment variable strings */
{
int retval;

argc = argc;
argv = argv;
envp = envp;

retval = load_blat();
if ( retval )
return( retval );

retval = blat_send("C:\\config.sys " \
"-s \"testing blat.dll\" " \
"-p attmail " \
"-t myself " \
"-attach \"g:\\blatdll\\blatdll.cpp\" " \
"-superdebug " \
"-noh2 " \
"-log \"C:\\smtp.log\"");

(void)FreeLibrary( blat_lib );
return(retval);
}
--------

I just compiled and ran it here on my WinXP system. Note that I have
already installed my server parameters, so it was not necessary for me
to
include them in this source code.
--
Chip






[Non-text portions of this message have been removed]
Chip
2007-03-27 13:51:20 UTC
Permalink
Post by Cripps Tim
Chip
Thankyou very much for taking the time to reply to my query. I shall
have a go.
I hope you don't mind me just asking a couple of questions about the
blat installation before I commence.
I have included the comments from the DLL that are required for the
installation in green below with my queries in red beneath.
I fully understand if you think you have helped me enough and I do
appreciate your help.
// Dependencies: for the email functionality to work correctly
the system must meet several requirments.
1: the following registry keys must exist, these keys should be setup
during install setup.
[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat]
On checking the Registry with regedit, I see that there is currently no
"Public Domain" directory. Do I need to create it and then do I need to
download Blat to that directory?
"SMTP server"="xxx.yyy" //email server
Can you tell me how to find out the name of the email server? I'm not
sure what format "xxx.yyy" takes?
Are you able to tell me how to find it?
"SMTP Port"="25" //email SMTP port
I'm not doing very well am I. Are you able to tell me how to find out
the SMTP Port?
"Try"="1" //number of times to rety sending email
2: Email address of the 'Admin' must be set in the registry, this key is
located in a sub dir
[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat] "Admin_Email"
and is a char
Can you tell me what the 'Admin' is used for and what is the sub dir
referred to above?
3: machine must have access to the internet
Again, many thanks for your help already
Tim
Email to me on this list comes in plain text, which means I get no color to
separate different parts of messages.

The registry entries are created by Blat.exe when you run Blat with
the -install option and the other parameters necessary to store the server
name, your email address, etcetera. The registry entries are not needed to
use Blat.exe or Blat.dll, as long as you provide the information to Blat in
the command line.

The email address provided to Blat can be just the fully qualified email
address alone without any "name" attached, or you could prepend the account
name to it. Examples of each method:

***@example.com

"Jane Doe <***@example.com>"


If you used the -install option with Blat, you should find
"[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat]". Within there would be
the parameters Blat uses to access your mail server. If a userid and
password are required, its easiest to let Blat store them here as well.

Chip
Cripps Tim
2007-03-27 11:43:27 UTC
Permalink
Chip
Sorry to be a nuisance. One more thing. In your example below, it
calls blat_send(). Would you mind just clarifying some points and
queries I have noted alongside the parameters in red.

retval = blat_send("C:\\config.sys " \ - is this where you are sending
config.sys as the message body?
"-s \"testing blat.dll\" " \ - This is the subject line of the message
"-p attmail " \ - This is the profile. User and Port is defined in
attmail. What is attmail? and what format does the User and the Port
take in that?
"-t myself " \ - recipient list. Have you set up a Contact of "myself"
with your e-mail address?
"-attach \"g:\\blatdll\\blatdll.cpp\" " \ - you have attached a binary
file of blatdll.cpp to the message
"-superdebug " \ - I assume this provides some level of debugging. What
does it do?
"-noh2 " \ - prevents showing X-Mailer header entirely
"-log \"C:\\smtp.log\""); - logs everything but usage to smtp.log

Regards

Tim


________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Chip
Sent: 27 March 2007 00:58
To: ***@yahoogroups.com
Subject: Re: [blat] using blat from a C++ Project
Post by tim.cripps
I need to be able to send faxes from a C++ project where Outlook might
not be available. To do this I beieve I can send an e-mail using 'BLAT'
to our fax server where it will be passed into a process which handles
the e-mail as a fax message.
Therefore to begin with, I need to set up and send an e-mail using BLAT
from the C++ project.
I have to admit that I've got a bit lost looking through all the
documentation on this and if there is anyone who can help me at least
get started, I would be very grateful.
Tim
It might be easiest to use blat.dll linked to your project. This means
you
won't have to spawn() a copy of Blat each time you want to send
something.
You also do not need to run "blat -install" prior to using the .dll, as
long
as you provide the server and email credentials to the .dll. Here is a
simple C++ program to use the .dll:

--------
#include <windows.h>
#include <stdio.h>
// #include <stdlib.h>

#ifdef WIN32
#define __far far
#define huge far
#define __near near
#endif

HMODULE blat_lib = 0;

int (FAR PASCAL *blat_send) (char FAR *);

// loads the BLAT DLL file
int __cdecl load_blat()
{
blat_lib = LoadLibrary("blat.dll");
if ( blat_lib == NULL )
{
printf("Could not load BLAT.DLL\nInstall this in your path.");
return(-1);
}

blat_send = (int (FAR PASCAL *)(char FAR *))GetProcAddress(blat_lib,
"Send");
if ( blat_send == NULL )
{
printf("couldn't getprocaddress for blat_send\n");
return(-1);
}
return(0);
}

int __cdecl main( int argc, /* Number of strings in array argv */
char **argv, /* Array of command-line argument strings */
char **envp ) /* Array of environment variable strings */
{
int retval;

argc = argc;
argv = argv;
envp = envp;

retval = load_blat();
if ( retval )
return( retval );

retval = blat_send("C:\\config.sys " \
"-s \"testing blat.dll\" " \
"-p attmail " \
"-t myself " \
"-attach \"g:\\blatdll\\blatdll.cpp\" " \
"-superdebug " \
"-noh2 " \
"-log \"C:\\smtp.log\"");

(void)FreeLibrary( blat_lib );
return(retval);
}
--------

I just compiled and ran it here on my WinXP system. Note that I have
already installed my server parameters, so it was not necessary for me
to
include them in this source code.
--
Chip






[Non-text portions of this message have been removed]
Chip
2007-03-27 13:59:36 UTC
Permalink
Post by Cripps Tim
Chip
Sorry to be a nuisance. One more thing. In your example below, it
calls blat_send(). Would you mind just clarifying some points and
queries I have noted alongside the parameters in red.
retval = blat_send("C:\\config.sys " \ - is this where you are sending
config.sys as the message body?
Yes.
Post by Cripps Tim
"-s \"testing blat.dll\" " \ - This is the subject line of the message
Correct.
Post by Cripps Tim
"-p attmail " \ - This is the profile. User and Port is defined in
attmail. What is attmail? and what format does the User and the Port
take in that?
The parameters specified in my source are specific to my machine. I have
several email accounts with AT&T and other ISPs, so I have created different
profiles. The -p option is used to select the specific profile I want.
Post by Cripps Tim
"-t myself " \ - recipient list. Have you set up a Contact of "myself"
with your e-mail address?
"myself" is a keyword within Blat source code. I created this to help
facilitate testing any code changes I make so I would not have to key in my
whole email address everytime I wanted to test something. This also helps
everyone else test their own configurations when they first install Blat, to
ensure they have the parameters defined correctly. The -to address will be
the same as the sender's email address.
Post by Cripps Tim
"-attach \"g:\\blatdll\\blatdll.cpp\" " \ - you have attached a binary
file of blatdll.cpp to the message
Yes.
Post by Cripps Tim
"-superdebug " \ - I assume this provides some level of debugging. What
does it do?
Check the output log file to see what it does. Basically, it dumps the
communications traffic in hex format so I can check that everything is sent
as expected, including all carriage returns and line feeds.
Post by Cripps Tim
"-noh2 " \ - prevents showing X-Mailer header entirely
Yes, I don't need it for emails I send to myself.
Post by Cripps Tim
"-log \"C:\\smtp.log\""); - logs everything but usage to smtp.log
That is where the communications debug data is stored.
Cripps Tim
2007-03-28 16:36:32 UTC
Permalink
Chip
Success!!!
I'm probably being a bit too quick to be saying that but I am sending
e-mails from C++ ok now.
However, I had to take out the 'superbug' parameter from the call to
blat_send() before it would work.

Thankyou for all your help and patience.

One final thing, I still don't understand the 'Admin email' key that is
set up in the registry. Can you explain what it is and whether it's
something I need to bother about and if so, what are the settings that
are needed. In the C++ example code it just states the following:

2: Email address of the 'Admin' must be set in the

registry, this key is located in a sub dir

[HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat] "Admin_Email"

and is a char


Regards

Tim

________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Chip
Sent: 27 March 2007 14:58
To: ***@yahoogroups.com
Subject: Re: [blat] using blat from a C++ Project
Post by Cripps Tim
Chip
Sorry to be a nuisance. One more thing. In your example below, it
calls blat_send(). Would you mind just clarifying some points and
queries I have noted alongside the parameters in red.
retval = blat_send("C:\\config.sys " \ - is this where you are sending
config.sys as the message body?
Yes.
Post by Cripps Tim
"-s \"testing blat.dll\" " \ - This is the subject line of the message
Correct.
Post by Cripps Tim
"-p attmail " \ - This is the profile. User and Port is defined in
attmail. What is attmail? and what format does the User and the Port
take in that?
The parameters specified in my source are specific to my machine. I have

several email accounts with AT&T and other ISPs, so I have created
different
profiles. The -p option is used to select the specific profile I want.
Post by Cripps Tim
"-t myself " \ - recipient list. Have you set up a Contact of "myself"
with your e-mail address?
"myself" is a keyword within Blat source code. I created this to help
facilitate testing any code changes I make so I would not have to key in
my
whole email address everytime I wanted to test something. This also
helps
everyone else test their own configurations when they first install
Blat, to
ensure they have the parameters defined correctly. The -to address will
be
the same as the sender's email address.
Post by Cripps Tim
"-attach \"g:\\blatdll\\blatdll.cpp\" " \ - you have attached a binary
file of blatdll.cpp to the message
Yes.
Post by Cripps Tim
"-superdebug " \ - I assume this provides some level of debugging. What
does it do?
Check the output log file to see what it does. Basically, it dumps the
communications traffic in hex format so I can check that everything is
sent
as expected, including all carriage returns and line feeds.
Post by Cripps Tim
"-noh2 " \ - prevents showing X-Mailer header entirely
Yes, I don't need it for emails I send to myself.
Post by Cripps Tim
"-log \"C:\\smtp.log\""); - logs everything but usage to smtp.log
That is where the communications debug data is stored.






[Non-text portions of this message have been removed]
Tim Musson
2007-03-28 17:01:18 UTC
Permalink
Hey Tim,

On Wednesday, March 28, 2007 at 12:36:32 PM you wrote

CT> One final thing, I still don't understand the 'Admin email' key that is
CT> set up in the registry. Can you explain what it is and whether it's
CT> something I need to bother about and if so, what are the settings that
CT> are needed. In the C++ example code it just states the following:

CT> 2: Email address of the 'Admin' must be set in the registry, this
CT> key is located in a sub dir

CT> [HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat] "Admin_Email" and
CT> is a char

The Registry entries are all optional. All the values you put in the
Registry can also be specified on the command line. If you have both,
then the command line options take precedence.
--
Tim Musson
Flying with The Bat! eMail v3.98.4
The reason men lie is because women ask so many questions.
Blat Manager, current version is 2.6.1, see www.blat.net
Cripps Tim
2007-03-29 09:06:40 UTC
Permalink
Tim
Thankyou for your reply. I understand that I can specify values in
the command line as well as in the Registry. What I don't understand is,
what the 'Admin' is, what it is used for, do I need to set it up (i.e.
is it mandatory), if it is required, what is the 'e-mail address' it
mentions in the code comment and what is the 'sub_dir' it also mentions.

Regards
Tim

________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Tim Musson
Sent: 28 March 2007 18:01
To: Cripps Tim
Subject: Re: [blat] using blat from a C++ Project



Hey Tim,

On Wednesday, March 28, 2007 at 12:36:32 PM you wrote

CT> One final thing, I still don't understand the 'Admin email' key that
is
CT> set up in the registry. Can you explain what it is and whether it's
CT> something I need to bother about and if so, what are the settings
that
CT> are needed. In the C++ example code it just states the following:

CT> 2: Email address of the 'Admin' must be set in the registry, this
CT> key is located in a sub dir

CT> [HKEY_LOCAL_MACHINE\SOFTWARE\Public Domain\Blat] "Admin_Email" and
CT> is a char

The Registry entries are all optional. All the values you put in the
Registry can also be specified on the command line. If you have both,
then the command line options take precedence.
--
Tim Musson
Flying with The Bat! eMail v3.98.4
The reason men lie is because women ask so many questions.
Blat Manager, current version is 2.6.1, see www.blat.net






[Non-text portions of this message have been removed]
Tim Musson
2007-03-29 11:43:22 UTC
Permalink
Hey Tim,

On Thursday, March 29, 2007 at 4:44:43 AM you wrote

CT> What I don't understand is, what the 'Admin' is, what it is used
CT> for, do I need to set it up (i.e. is it mandatory), if it is
CT> required, what is the 'e-mail address' it mentions in the code
CT> comment and what is the 'sub_dir' it also mentions.

I have looked around for what you are referring to and can't find it.
Where do you see 'Admin', 'e-mail address', & 'sub_dir' referenced in
regards to the Registry?
--
Tim Musson
Flying with The Bat! eMail v3.98.4
Just when I was getting used to yesterday, along came today.
Blat Manager, current version is 2.6.1, see www.blat.net
Cripps Tim
2007-03-29 12:16:14 UTC
Permalink
Tim
It is in the dll provided by Toby Blat. blat.reg has the registry
settings and in the source file email.cpp he has some comments at the
head of the file under 'Dependancies' that state the requirements. One
of these requirements covers the Admin Mail value and 'sub dir'.

Regards

Tim

________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Tim Musson
Sent: 29 March 2007 12:41
To: Cripps Tim
Subject: Re: [blat] using blat from a C++ Project



Hey Tim,

On Thursday, March 29, 2007 at 4:44:43 AM you wrote

CT> What I don't understand is, what the 'Admin' is, what it is used
CT> for, do I need to set it up (i.e. is it mandatory), if it is
CT> required, what is the 'e-mail address' it mentions in the code
CT> comment and what is the 'sub_dir' it also mentions.

I have looked around for what you are referring to and can't find it.
Where do you see 'Admin', 'e-mail address', & 'sub_dir' referenced in
regards to the Registry?
--
Tim Musson
Flying with The Bat! eMail v3.98.4
Just when I was getting used to yesterday, along came today.
Blat Manager, current version is 2.6.1, see www.blat.net






[Non-text portions of this message have been removed]
Tim Musson
2007-03-29 14:06:49 UTC
Permalink
Hey Cripps,

On Thursday, March 29, 2007 at 8:16:14 AM you wrote

tm>> I have looked around for what you are referring to and can't find
tm>> it. Where do you see 'Admin', 'e-mail address', & 'sub_dir'
tm>> referenced in regards to the Registry?

CT> It is in the dll provided by Toby Blat. blat.reg has the registry
CT> settings and in the source file email.cpp he has some comments at
CT> the head of the file under 'Dependancies' that state the
CT> requirements. One of these requirements covers the Admin Mail
CT> value and 'sub dir'.

Ok, Now I understand. I don't think Toby has released a blat.dll since
the 1.9.4 days (which puts it 4 years old). The current version of
Blat is 2.6 and comes with a .dll compiled from the same source as the
.exe. I suggest you go to the blat web site and get a more recent
version.
--
Tim Musson
Flying with The Bat! eMail v3.98.4
Paper clips are the larval stage of coat hangers.
Blat Manager, current version is 2.6.1, see www.blat.net
Cripps Tim
2007-03-29 16:27:33 UTC
Permalink
Tim
Thanks a lot. I have now downloaded the latest version and got the
dll from there. That also explains a lot of the problems I was having as
some of the parameters I was using probably weren't available for the
older dll and stopped it working.

Cheers
Tim

p.s. if either you or Chip are in Basingstoke any time, the drinks are
on me - and I don't say that very often!!!

________________________________

From: ***@yahoogroups.com [mailto:***@yahoogroups.com] On Behalf Of
Tim Musson
Sent: 29 March 2007 15:07
To: Cripps Tim
Subject: Re: [blat] using blat from a C++ Project



Hey Cripps,

On Thursday, March 29, 2007 at 8:16:14 AM you wrote

tm>> I have looked around for what you are referring to and can't find
tm>> it. Where do you see 'Admin', 'e-mail address', & 'sub_dir'
tm>> referenced in regards to the Registry?

CT> It is in the dll provided by Toby Blat. blat.reg has the registry
CT> settings and in the source file email.cpp he has some comments at
CT> the head of the file under 'Dependancies' that state the
CT> requirements. One of these requirements covers the Admin Mail
CT> value and 'sub dir'.

Ok, Now I understand. I don't think Toby has released a blat.dll since
the 1.9.4 days (which puts it 4 years old). The current version of
Blat is 2.6 and comes with a .dll compiled from the same source as the
.exe. I suggest you go to the blat web site and get a more recent
version.
--
Tim Musson
Flying with The Bat! eMail v3.98.4
Paper clips are the larval stage of coat hangers.
Blat Manager, current version is 2.6.1, see www.blat.net






[Non-text portions of this message have been removed]
Chip
2007-03-30 02:16:19 UTC
Permalink
Post by Cripps Tim
Tim
Thanks a lot. I have now downloaded the latest version and got the
dll from there. That also explains a lot of the problems I was having as
some of the parameters I was using probably weren't available for the
older dll and stopped it working.
Cheers
Tim
p.s. if either you or Chip are in Basingstoke any time, the drinks are
on me - and I don't say that very often!!!
As a matter of fact, I hope to be on that side of the pond sometime next
year riding my motorcycle through UK and Europe for a few weeks. :)
Chip
2007-03-27 13:51:28 UTC
Permalink
I will try this again, but this time including other things to let Blat.dll
work without requiring anything from the Windows registry.

--------
#include <windows.h>
#include <stdio.h>
// #include <stdlib.h>

#ifdef WIN32
#define __far far
#define huge far
#define __near near
#endif

HMODULE blat_lib = 0;

int (FAR PASCAL *blat_send) (char FAR *);


// loads the BLAT DLL file
int __cdecl load_blat()
{
blat_lib = LoadLibrary("blat.dll");
if ( blat_lib == NULL )
{
printf("Could not load BLAT.DLL\nInstall this in your path.");
return(-1);
}

blat_send = (int (FAR PASCAL *)(char FAR *))GetProcAddress(blat_lib,
"Send");
if ( blat_send == NULL )
{
printf("couldn't getprocaddress for blat_send\n");
return(-1);
}
return(0);
}


int __cdecl main( int argc, /* Number of strings in array argv */
char **argv, /* Array of command-line argument strings */
char **envp ) /* Array of environment variable strings */
{
int retval;

argc = argc;
argv = argv;
envp = envp;

retval = load_blat();
if ( retval )
return( retval );

retval = blat_send("- -body \"This is the body of my outgoing
email.||Signed,|Chip\" " \
"-s \"testing blat.dll\" " \
"-server mail.example.com " \
"-t ***@example.com" \
"-attach \"g:\\blatdll\\blatdll.cpp\" " \
"-f ***@example.com" \
"-noh2 " \
"-log \"C:\\smtp.log\"");

(void)FreeLibrary( blat_lib );
return(retval);
}
--------
Continue reading on narkive:
Loading...