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.crippsI 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]