> ----- Original Message ----- 
> From: malak almalak
>
> I've tried to do simple program to send email to gmail but I've faced many
> problems:
> 1- when I use the default port for smtp which is 25 --> error message has
> raised 'error#10060 connection time out'

no server after trying to connect for 30 seconds or so.

> 2- when I use the port 465, the program is running endlessly.

maybe login success, sending, and waiting for end of file, in RFC822
language, it is #13#10'.'#13#10.

> 3- when I used the port 587, the exception raised 'Need SASL mechanism to
> login with it'

don't have a clue, once I tried to install OpenSSL, but can't get it to
work, hiks.. ;(

> What's wrong with my program? Do I need to add somthing to it?
> kindly see the program attached.
> Your assistance is heavily apprecited.

what version of Indy did you use?
I used Indy.v9, and a different technique with TIdMessage.
I used TIdMessage.LoadFromFile().

After TIdSMTP connect and was sending email, the program
run endlessly, the problem was that TIdSMTP was waiting
for #13#10'.'#13#10 which mark the end of DATA session, the
document that I was sending through TIdMessage.LoadFromFile()
is an old plain .txt file.

I have to manually apply RFC822 transparency, change every
#13#10'.'#13#10 into #13#10'..'#13#10 and add a final
#13#10'.'#13#10 as it marks the end of file, that was the
requirement of RFC822.

After I changed the .txt file in memory, and send it to TIdMessage
through LoadFromStream(), TIdSMTP worked normally.

That was TIdMessage.LoadFromFile and Indy. v9, I don't know
whether TIdMessage.Body.Text works the same way.

Indy.v9 has a problem when receiving emails with TIdPop3,
once a while you will receive email with the headers, but no body
( content ).
The problem is that TIdMessage only expected to *ReadLn* from
the socket with the maximum length of MaxLineLength.
If it encounter a single line that longer than MaxLineLength,
an exception is raised.
You only get headers, and no content, coz mail software always
force header length to only 76-78 character, so no problem there,
you can always receive headers.
The culprit is TIdMessage, Indy developers assume that it will be
used to read continuous stream of data from a socket, and all
email software will obey the MaxLineLength limit, which they don't.

I recommed not using TIdPOP3 from Indy.v9 distribution.
If you plan to create your own POP3Client, you might want to
use this,
con := TIdTCPClient.Create(nil);
con.MaxLineLength := 0;

Do you know that you can telnet SMTP servers? you can even
send email from MsDos prompt.
This is from the old ways, when every body uses console.
Try connect to the internet, open Dos prompt, and type
1. "telnet mail.xxxx.com 25" [ENTER]
and *see* the response from the server, type
2. "HELO computername" [ENTER]
afterward type to exit
3. "QUIT" [ENTER]
server disconnect, you are done with telnet session, telnet quits.

Hope this expand your view about the subject.
------------
FIreHAzaR:-D
West Java, Indonesia

Reply via email to