0

First i have this code and i tried with Gmail Smtp server but i have the result with error exception : Socket °10060 !!!! it a delay socket error , please if any one tried this before and it work for him just share the idea with me thanks !!!!

 VAR SMTP : TIdSMTP;  VAR MSG : TIdMSG;
 MSG:=TIdMSG.Create(NIL);

 TRY
    WITH MSG.Recipients.Add DO BEGIN
  Name:='<Name of recipient>';
  Address:='<Email address of recipient>'
END;
MSG.BccList.Add.Address:='<Email address of Blind Copy recipient>';
MSG.From.Name:='<Name of sender>';
MSG.From.Address:='<Email address of sender>';
MSG.Body.Text:='<Message Body>';
MSG.Subject:='<Subject of message>';
SMTP:=TIdSMTP.Create(NIL);
TRY
  SMTP.Host:='x.x.x.x'; // IP Address of SMTP server
  SMTP.Port:=25; // Port address of SMTP service (usually 25)
  SMTP.Connect;
  TRY
    SMTP.Send(MSG)
  FINALLY
    SMTP.Disconnect
  END
FINALLY
  SMTP.Free
END

FINALLY MSG.Free END;

AnFi
  • 10,493
  • 3
  • 23
  • 47
Oussaki
  • 1,449
  • 2
  • 21
  • 30
  • For GMail you need TLS. Check out the answer here: http://stackoverflow.com/a/7044809/800214 – whosrdaddy May 10 '13 at 11:02
  • @TLama: promoting your answer? ;) – whosrdaddy May 10 '13 at 11:16
  • 1
    @whosrdaddy, a little bit :-) Actually, I've used [`the search`](http://data.stackexchange.com/stackoverflow/query/76922/search-my-own-answer-posts) for `gmail` in my answers ;-) – TLama May 10 '13 at 11:26
  • @TLama: cool! didn't know this was possible. – whosrdaddy May 10 '13 at 11:28
  • @whosrdaddy, but `data.stackexchange.com` is synchronized with a month delay and only with non deleted answers. You might find useful also [`the other search queries`](http://data.stackexchange.com/users/8200/tlama?order_by=favorite). – TLama May 10 '13 at 11:32
  • And another problem with the link you gives to me , ican't find TIdMessageBuilderHTML component in my indy components items ... i used Indy 10 ??? – Oussaki May 10 '13 at 11:42
  • I often had problems when I had the wrong Indy10 version (too old), and solved it by moving to latest Indy10 version from subversion repository, or by changing the SSL DLL version to a known working version. – Warren P May 10 '13 at 12:31
  • @Oussaki, add `IdMessageBuilder` to the uses clause. – TLama May 10 '13 at 16:51

0 Answers0