πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

INDY TIdSMTP example

#4462
From: Roberto Zais
Date: Wed, 09 Feb 2005 11:08
103 lines
4575 bytes
I've collected over Internet some examples/suggestions   about this
component , and I have
built by own code : I add beyond.
It works, the mail is sent , but there are two problems :
1) the text of the message is empty : the text I have added is contained
into an attachment   named <subject>.dat
2) the creation data showed by Outlook express on receiving the messages
sounds like : "lunedοΏ½ 7 febbraio 2005 0.00"
    ( the hour-minute indo is always zero )
Is there any evident error into my code ?? I admit my little SMTP culture
...  :-)
Thanks in advance for all informations and examples ..
ciao
Roberto


MyMsg = new TIdMessage(DataModule11);
TIdSMTP * MyIdSMTP1 = new TIdSMTP(DataModule11);
                                        // Runtime code
/*
try{
*/
    // Ensure the Query has a unique session and database.  A unique session
    // is required for each thread.  Since databases are session specific
    // it must be unique as well
    // Update the status line.
while(1)
     {
     if( sendmail_flag == true)
        {

        try{

        MyMsg->Clear();
        MyMsg->CharSet = "Windows-1251";
        MyMsg->From->Name = "";
//"Automatin Notifying Sistem";
        MyMsg->From->Address = roberto@provider.it;
        MyMsg->Sender->Name = ""; //"*** Postazione Sistema ***";
        MyMsg->Sender->Address = "roberto@provider.it";
        MyMsg->UseNowForDate = true;
        //MyMsg->Date = Now();  // store the current date and time
        //MyMsg->Recipients->EMailAddresses = "destination@prov.it";    //
forma ok ma con solo 1 addr.
        MyMsg->Recipients->Add();
        MyMsg->Recipients->Items[0]->Address = Edit_indirizzo_mail-1->Text;
//      MyMsg->Recipients->Add();
//      MyMsg->Recipients->Items[1]->Address = Edit_indirizzo_mail-2->Text;
        temps.sprintf("Lista partecipanti N.%d ",turno_attuale);
        MyMsg->Subject = temps;
        MyMsg->Priority  = mpNormal;
        MyMsg->Body->Text = Form12->RichEdit1->Text;            //  ****
TEXT of the message !!   */
        MyMsg->IsEncoded = false;
        //TIdText(MyMsg->MessageParts, Add("***Esercizio spedizione***"));
// 1

        MyIdSMTP1->Host = "dominion.it"; //Host->Text;
        MyIdSMTP1->UserId = "roberto"; //Username->Text;
        MyIdSMTP1->Password = "password";  //Password->Text;

        MyIdSMTP1->AuthenticationType = atNone;


// INIZIO fase spedizione effettiva

        MyMsg->Date = Now();                                            //
store the current date and time
        if(MyIdSMTP1->Connected())
                MyIdSMTP1->Disconnect();
        MyIdSMTP1->Host = "mail.dominion.it";                     // Server
SMTP
        MyIdSMTP1->UserId = "rob";
        MyIdSMTP1->Port = 25;
        MyIdSMTP1->Connect();
        MyIdSMTP1->Send(MyMsg);
        if(MyIdSMTP1->Connected())
                MyIdSMTP1->Disconnect();
//==========================================================================
====================

other reference examples I' ve found ...

/*
IdMsg = new TIdMessage(this);
IdMsg->CharSet = "Windows-1251";
IdMsg->Subject = "Subj";
IdMsg->From->Name = "???? ??????";
IdMsg->From->Address = "Ivan@mail.nnov.ru"; // ????????
IdMsg->Sender->Name = "???? ??????";
IdMsg->Sender->Address = "Ivan@mail.nnov.ru";
IdMsg->UseNowForDate = true;
IdMsg->Recipients->Add();
IdMsg->Recipients->Items[0]->Address = "Klava@mail.nnov.ru";
*/

//MyMsg->Body->Add("????? ??????");
//
//TIdText(MyMsg->MessageParts, Memo1->Lines); // 1
//TIdText(MyMsg->MessageParts, Memo1->Lines); // 2

//TIdAttachment(MyMsg->MessageParts, "Ivan1.xml");
//TIdAttachment(MyMsg->MessageParts, "Ivan2.xml");
Technical Details
Message-ID: <4209ee05$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,c17ebca7aaa2a060,start
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII
From: "Roberto Zais" <rzaiss@tiscali.it>
Newsgroups: borland.public.cppbuilder.internet.socket
Subject: INDY TIdSMTP example
Date: Wed, 9 Feb 2005 12:08:13 +0100
Lines: 105
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
NNTP-Posting-Host: 82.48.83.104
Message-ID: <4209ee05$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1107947013 82.48.83.104 (9 Feb 2005 03:03:33 -0800)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.maxwell.syr.edu!newspeer1.nwr.nac.net!news-out.newsgroups.com!propagator2-sterling.newsfeeds.com!in.nntp.be!caladan.landsraad.net!newsgroups.borland.com!not-for-mail