🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2145

Re: How to send email from application

#2145
From: Andrue Cope [TeamB]
Date: Tue, 01 Aug 2006 07:02
62 lines
2711 bytes
Benjamin wrote:

> Hi i wanna send an email from my application, assuming that the user
> or me does not have outlook setup etc. Also wondering how to
> authenticate if i was to use smtp.google.com as host ? I duno.. plse
> help.

Hope this helps:

  AnsiString filePath=General_TemporaryFilePath()+".VRA";

  sl->SaveToFile( filePath );

  MapiMessage message;
  memset( &message, 0, sizeof( message ) );

  switch( MessageDlg( "For convenience a control file has been prepared
listing the viewers "
                      "you want assistance with. Do you want to email
this file now?",
                      mtConfirmation,
                      TMsgDlgButtons()<<mbYes<<mbNo<<mbCancel,
                      0 ) )
  {
    case mrYes:
    {
      message.lpszSubject="I need assistance";
      message.lpszNoteText="Please open the link below using WindyE and
let me know what "
                           "conclusions you draw.";

      MapiRecipDesc recipInfo;
      memset( &recipInfo, 0, sizeof( recipInfo ) );
      recipInfo.ulRecipClass=MAPI_ORIG;
      recipInfo.lpszName="";
      recipInfo.lpszAddress="";
      message.lpOriginator=&recipInfo;

      MapiFileDesc fileInfo;
      memset( &fileInfo, 0, sizeof( fileInfo ) );
      fileInfo.nPosition=0;
      fileInfo.lpszPathName=filePath.c_str();
      fileInfo.lpszFileName="Assistance request";
      message.nFileCount=1;
      message.lpFiles=&fileInfo;

      MapiRecipDesc recipInfo2;
      memset( &recipInfo2, 0, sizeof( recipInfo2 ) );
      recipInfo2.ulRecipClass=MAPI_TO;
      recipInfo2.lpszName="";
      recipInfo2.lpszAddress="";

      message.nRecipCount=1;
      message.lpRecips=&recipInfo2;

      break;
    }

-- 
Andrue Cope [TeamB]
[Bicester, Uk]
http://info.borland.com/newsgroups/guide.html
Technical Details
Message-ID: <44cefc74$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44cea7fe@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,1d9ead3e9a8a80c5
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Andrue Cope [TeamB]" <no.spam@not.a.valid.address>
Subject: Re: How to send email from application
Newsgroups: borland.public.cppbuilder.internet.socket
References: <44cea7fe@newsgroups.borland.com>
User-Agent: XanaNews/1.18.1.1
MIME-Version: 1.0
Content-Type: text/plain; charset=iso-8859-1
NNTP-Posting-Host: 217.207.223.34
Message-ID: <44cefc74$1@newsgroups.borland.com>
Date: 1 Aug 2006 00:02:12 -0700
X-Trace: newsgroups.borland.com 1154415732 217.207.223.34 (1 Aug 2006 00:02:12 -0700)
Lines: 62
X-Authenticated-User: acope
Path: arc1-ca.pugleaf.net!g2news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail