🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Bare LFs in SMTP

#2729
From: Mr. Wuf
Date: Fri, 27 Jan 2006 13:23
93 lines
3826 bytes
> Then please show your actual code.  The "bare LF" error is commonly causes
> by the lines of your message being too long.

The "MaxLineLength" property of TIdSMTP is set to 0 (zero) and
"MaxLineAction" to maException.
This are only the code pieces of the entire code (sorry, this is not
opensource):

  TIdAttachment *att;
  TIdText *NText;
  TIdText *EText;
  TIdText *HText;
  SMTPMessage->Clear();
  SMTPMessage->From->Text = ComboBox3->Text;
  SMTPMessage->Priority = TIdMessagePriority(ComboBox5->ItemIndex);
  SMTPMessage->Recipients->EMailAddresses = Edit1->Text;
  SMTPMessage->Subject = SubjectEdit->Text;
  SMTPMessage->UseNowForDate = true;
  SMTPMessage->CharSet = ComboBox7->Text;
  IdSMTP1->AuthenticationType = atLogin;
  IdSMTP1->Host = AccountFile->Lines->Strings[4];
  IdSMTP1->Port = StrToInt(AccountFile->Lines->Strings[5]);
  IdSMTP1->Username = AccountFile->Lines->Strings[6];
  IdSMTP1->Password = AccountFile->Lines->Strings[7];

  // create messageparts
  if (Memo2->Text != "")
  {
    NText = new TIdText(SMTPMessage->MessageParts, NULL);
    NText->ContentType = "text/plain";
    NText->Body = Memo2->Lines;

    // Encode message
    if (ComboBox6->Text == "base64" && LMDRadioButton1->Checked) {
NText->Body->Text =
SetValidBase64(IdEncoderMIME1->Encode(NText->Body->Text));
NText->ContentTransfer = "base64"; }
  }

  // There was a bug in an old Indy version. 1 message part caused an
error.. so create a blank text-part
  int TextParts = 0;
  for (int MP=0; MP < SMTPMessage->MessageParts->Count; MP++)
  {
    if(dynamic_cast<TIdText*>(SMTPMessage->MessageParts->Items[MP]));
    TextParts++;
  }
  if (TextParts == 1)
  {
    TIdText *CompatiblePart = new TIdText(SMTPMessage->MessageParts, NULL);
    CompatiblePart->ContentType = "text/plain";
  }

  // Create attachments ...
  for (int i=0; i < AttachmentForm->ListView1->Items->Count; i++)
  {
    try
    {
      att = new TIdAttachment(SMTPMessage->MessageParts,
AttachmentForm->ListView1->Items->Item[i]->Caption);
    }
    catch(...)
    {
       // error msg...
    }
  }

  if (LMDRadioButton7->Checked)
  {
    // .. for "SMTP after POP"
    IdPOP31->Connect();
    int SaP = IdPOP31->CheckMessages();  // do something...
    IdPOP31->Disconnect();
  }

  try
  {
    IdSMTP1->Connect();
    IdSMTP1->AuthenticationType = atNone;
    if (LMDRadioButton4->Checked)
      IdSMTP1->AuthenticationType = atLogin;

    if (IdSMTP1->AuthenticationType == atLogin)
      if (!IdSMTP1->Authenticate())
        Application->MessageBox("Authentication error!", "MailGate",0+16);
  }
  catch(...)
  { Application->MessageBox("Error connecting server","MailGate",0+16);

  IdSMTP1->Send(SMTPMessage);

  // delete pointer ...
  .......
Technical Details
Message-ID: <43da1e0d@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <43d80b2b$1@newsgroups.borland.com> <43d81c0d$1@newsgroups.borland.com> <43d8ce05@newsgroups.borland.com> <43d912e0$1@newsgroups.borland.com> <43d96959@newsgroups.borland.com> <43d97297@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,c40bbd54da4c4431
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Mr. Wuf" <wuf@email.si>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <43d80b2b$1@newsgroups.borland.com> <43d81c0d$1@newsgroups.borland.com> <43d8ce05@newsgroups.borland.com> <43d912e0$1@newsgroups.borland.com> <43d96959@newsgroups.borland.com> <43d97297@newsgroups.borland.com>
Subject: Re: Bare LFs in SMTP
Date: Fri, 27 Jan 2006 14:23:47 +0100
Lines: 95
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
NNTP-Posting-Host: 84.59.75.117
Message-ID: <43da1e0d@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1138368013 84.59.75.117 (27 Jan 2006 05:20:13 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!proxad.net!212.101.4.254.MISMATCH!solnet.ch!solnet.ch!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail