1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
|
// C/C++ Email Example
#include <windows.h>
#include <stdio.h>
#include "see.h"
// connect to SMTP server then send email
int SendMail(char *ToList, char *Subject, char *Message)
{int Code;
char *SmtpHost = "smtp.my-isp.com";
char *SmtpUser = "my-user-name";
char *SmtpPass = "my-password";
char *SmtpFrom = "<mike@my-isp.com>"
char *SmtpReply= "<mike@my-isp.com>"
char *ccList = NULL;
char *bccList = NULL;
char *Attachments = NULL;
// specify the port to connect on (default port is 25)
seeIntegerParam(0, SEE_SMTP_PORT, 587);
// enable "SMTP Authentication"
seeIntegerParam(0, SEE_ENABLE_ESMTP, 1);
// specify the user name and password for SMTP authentication
seeStringParam(0, SEE_SET_USER, SmtpUser);
seeStringParam(0, SEE_SET_SECRET, SmtpPass);
// connect to SMTP server
Code = seeSmtpConnect(0, SmtpHost, SmtpFrom, SmtpReply);
// error ? (negative return codes are errors)
if(Code<0) return Code;
// send email to list of recipients (ToList)
Code = seeSendEmail(0,ToList,ccList,bccList,Subject,Message,Attachments);
}
|