Avatar of mylescameron
mylescameron

asked on 

Using TIdAttachmentFile in borland, No file name when sending email??

Hi im writing a simple program to send emails, but when i send the emails i cannot see the filename it will just come up with "noname" (this is seen in gmail). I want the name to be shown plus the file type. Also how would i try catch the connection statment withour causeing errors?. Please Help.
//setup idSMTP connection parameters
  IdSMTP->Host = HostAdd->Text;
  IdSMTP->Port = atoi(HostPort->Text.c_str());
  IdSMTP->Username = SMTPuser->Text ;
  IdSMTP->Password = SMTPpass->Text;
 
  //Open SSL IOHANDLER
 
        IdSSLIOHandlerSocketOpenSSL1->Host = HostAdd->Text;
        IdSSLIOHandlerSocketOpenSSL1->Port = atoi(HostPort->Text.c_str());
 
  //setup idmessage parameters
  IdMessage1->From->Address = SenderAdd->Text;
  IdMessage1->From->Name = SenderName->Text;
 
 IdMessage1->Recipients->EMailAddresses = AltEmail->Text; break;
 
 
  IdMessage1->Subject = EmailSubject->Text;
  IdMessage1->Body->Text = EmailMainTxt->Lines->Text;
 
  // attach files
        for(int cnt1 = -1 + MMSAttList->Items->Count; cnt1 !=0; cnt1--){
  TIdAttachmentFile *AttachEmail = new TIdAttachmentFile(IdMessage1->MessageParts,
  MMSAttList->Items->Strings[cnt1]);
 
 }
 
                IdSMTP->Connect();
                IdSMTP->Send(IdMessage1);
                IdSMTP->Disconnect();

Open in new window

C++Delphi

Avatar of undefined
Last Comment
Eddie Shipman

8/22/2022 - Mon