C/C++ Email Example

// 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 = "";
 char *SmtpUser = "my-user-name";
 char *SmtpPass = "my-password";
 char *SmtpFrom = "<>"
 char *SmtpReply= "<>"
 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);

MSC Logo

MARSHALLSOFT is a trademark of MarshallSoft Computing, Inc.