home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Shareware 35
/
hot35.iso
/
ficheros
/
LC
/
SEE4C10.ZIP
/
PARAM.C
< prev
next >
Wrap
C/C++ Source or Header
|
1998-05-28
|
4KB
|
134 lines
/* param.c */
#include <windows.h>
#include "param.h"
#include "message.h"
#include "paint.h"
#include "see.h"
/////////////////////////////////////////////////////////
////// IMPORTANT: edit these definitions before compiling
#define SMTP_HOST_NAME "smtp_host_name"
#define YOUR_EMAIL_ADDR "your_email_address"
#define SEND_TO "receipient's email address"
////// EXAMPLE //////////////////////////////////////////
// #define SMTP_HOST_NAME "mail.myisp.net"
// #define YOUR_EMAIL_ADDR "<me@myisp.com>"
// #define SEND_TO "<mike@marshallsoft.com>"
/////////////////////////////////////////////////////////
#define MAX_BUF 1024
#define MAX_STR 80
static char Temp[MAX_STR+8] = "\0";
static char Server[MAX_STR+1] = SMTP_HOST_NAME;
static char From[MAX_STR+1] = YOUR_EMAIL_ADDR;
static char To[MAX_STR+1] = "\0";
static char Subj[MAX_STR+1] = "\0";
static char Message[MAX_BUF+1]= "\0";
void DisplayError(int Code)
{static char ErrorMsg[MAX_STR+1];
seeErrorText(Code,(LPSTR)ErrorMsg,MAX_STR);
wsprintf((LPSTR)Temp,"SEE Error %d: %s", Code, (LPSTR)ErrorMsg);
DisplayLine((LPSTR)Temp);
}
#ifdef WIN32
BOOL CALLBACK
#else
BOOL FAR PASCAL
#endif
ParamDlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam)
{int n;
int Code;
switch (iMsg)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
if(wParam==IDOK)
{//EndDialog(hDlg, TRUE);
return TRUE;
}
if(wParam==IDCANCEL)
{EndDialog(hDlg, TRUE);
return TRUE;
}
if(wParam==MSG_QUIT)
{EndDialog(hDlg, TRUE);
return TRUE;
}
if(wParam==MSG_SENDMAIL)
{
n = GetDlgItemText(hDlg, DB_SUBJ, (LPSTR)Subj, MAX_STR);
Subj[n] = '\0';
n = GetDlgItemText(hDlg, DB_TO, (LPSTR)To, MAX_STR);
To[n] = '\0';
n = GetDlgItemText(hDlg, DB_MSG, (LPSTR)Message, MAX_BUF);
Message[n] = '\0';
{static char Temp[MAX_BUF+1];
wsprintf((LPSTR)Temp,"Server = [%s]", (LPSTR)Server);
DisplayLine((LPSTR)Temp);
wsprintf((LPSTR)Temp,"From = [%s]", (LPSTR)From);
DisplayLine((LPSTR)Temp);
#if 1
wsprintf((LPSTR)Temp,"Subj = [%s]", (LPSTR)Subj);
DisplayLine((LPSTR)Temp);
wsprintf((LPSTR)Temp,"To = [%s]", (LPSTR)To);
DisplayLine((LPSTR)Temp);
wsprintf((LPSTR)Temp,"Message = [%s]", (LPSTR)Message);
DisplayLine((LPSTR)Temp);
#endif
}
/* check address */
Code = seeVerifyFormat((LPSTR)To);
if(Code<0)
{DisplayError(Code);
break;
}
seeStringParam(SEE_LOG_FILE, (LPSTR)"quick.log"); /*!!!*/
/* connect to SMTP server */
DisplayLine("Calling seeConnectTo()...");
Code = seeConnectTo(
(LPSTR)Server,
(LPSTR)From,
(LPSTR)NULL);
if(Code<0)
{DisplayError(Code);
break;
}
/* send email */
DisplayLine("Calling seeSendEmail()...");
Code = seeSendEmail(
(LPSTR)To,
(LPSTR)NULL, /* no CC list */
(LPSTR)NULL, /* no BCC list */
(LPSTR)Subj,
(LPSTR)Message,
(LPSTR)NULL); /* no attachments */
if(Code<0)
{DisplayError(Code);
break;
}
DisplayLine("Calling seeClose()...");
DisplayLine("Email has been sent.");
Code = seeClose();
EndDialog(hDlg, TRUE);
return TRUE;
}
break;
}
return FALSE;
} /* end ParamDlgProc */