BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Delphi 2005. Indy 10. TIdSMTP.Send - Borland.Delphi.ERangeEr

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock
View previous topic :: View next topic  
Author Message
Ender
Guest





PostPosted: Sun Feb 26, 2006 11:03 am    Post subject: Delphi 2005. Indy 10. TIdSMTP.Send - Borland.Delphi.ERangeEr Reply with quote



Hello, All!

I'm trying to write simple application which send content of file or
arbitrary text to some address through TIdSMTP component. Once execution
reached TIdSMTP.Send method it raise following error:

Exception class Borland.Delphi.ERangeError with message 'Range check error'.
Process mailto.exe (2076)

Call stack shows that exception is raised in IdCoderHeader::EncodeHeader
function at line 710

T := T + base64_tbl[B0 SHR 2] +
base64_tbl[B0 AND $03 SHL 4 + B1 SHR 4] +
base64_tbl[B1 AND $0F SHL 2 + B2 SHR 6] +
base64_tbl[B2 AND $3F];

Call stack:

IdCoderHeader.Units.IdCoderHeader::@31$EncodeHeader$EncodeWord()
IdCoderHeader.Units.IdCoderHeader::EncodeHeader()
IdMessage.TIdMessage::GenerateHeader()
IdMessageClient.TIdMessageClient::SendHeader()
IdMessageClient.TIdMessageClient::SendMsg()
IdSMTPBase.TIdSMTPBase::SendPipelining()
IdSMTPBase.TIdSMTPBase::InternalSend()
IdSMTP.TIdSMTP::Send()
mailto.Units.mailto::mailto()

It seems that header is going to encoded but i'm don't want this. How to
avoid this erroneous code?

The code that call Send follows.

program mailto;
{$APPTYPE CONSOLE}
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.dll'}
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.Data.dll'}
{%DelphiDotNetAssemblyCompiler
'$(SystemRoot)\microsoft.net\framework\v1.1.4322\System.XML.dll'}

uses
SysUtils,
uConversions in '..\..\common\src\Generic\uConversions.pas',
uParamLine in '..\..\common\src\Generic\uParamLine.pas',
uHelp in 'uHelp.pas',
AssemblyInfo in 'AssemblyInfo.pas',
cOptions in 'cOptions.pas',
cMailSender in 'cMailSender.pas',
IdMessage, IdSMTP, IdEMailAddress, IdCharSets,
System.IO;

var
Options:TOptions;
Msg:TIdMessage;
SMTP:TIdSMTP;
begin
{$R *.res}
if IsVersionNeeded then PrintVersion;
if IsHelpNeeded then
begin
PrintHelp;
Exit;
end;
Options:=TOptions.Create;
Msg:=TIdMessage.Create;
Msg.Sender:=TIdEmailAddressItem.Create(NIL);
Msg.Sender.Text:=Options.FromAddress;
Msg.From.Text:=Options.FromAddress;
Msg.Recipients.Add.Text:=Options.ToAddress;
Msg.ContentType:='text/plain';
Msg.Charset:=IdCharsetNames[idcswindows_1251];
Msg.ContentTransferEncoding:='8bit';
Msg.Subject:=Options.Subject;
if Options.Text<>'' then
Msg.Body.Text:=Options.Text
else
if (Options.ContentFile<>'') and FileExists(Options.ContentFile) then
Msg.Body.LoadFromFile(Options.ContentFile);
SMTP:=TIdSMTP.Create;
SMTP.Host:=Options.Server;
SMTP.Username:=Options.UserName;
SMTP.Password:=Options.Password;
SMTP.Connect;
SMTP.Send(Msg); // !!! EXCEPTION - ERangeError !!!
end.

Msg.Subject and Msg.Body.Text is strings that contain cyrillic letters in
win1251 codepage.

With best regards, Ender. E-mail: linuxmustdie (AT) hotmail (DOT) com
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Internet Winsock All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.