Following is my code for the smtp client for sending email
VAR SMTP : TIdSMTP; MSG : TIdmessage; begin MSG:=TIdmessage.Create(NIL); TRY WITH MSG.Recipients.Add DO BEGIN Name:='me025'; Address:='me025@gmail.com' END; MSG.BccList.Add.Address:='me025@yahoo.com'; MSG.From.Name:='self025'; MSG.From.Address:='self025@127.0.1.1'; MSG.Body.Text:='<Message Body>'; MSG.Subject:='<Subject of message>'; SMTP:=TIdSMTP.Create(NIL); TRY SMTP.Host:='127.0.1.1'; // IP Address of SMTP server // 127.0.1.1 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; end;
which will use a SMTPserver in same pc
the smtp server is a working indy 10 unofficial sample http://indy.fulgan.com/ZIP/Indy10demo.zip
whenever i connect to the server "Socket error # 11001 Host not found " error occers
but smtp server is receiving all the parameters correctly and showing correctly on the GUI