Wysyłanie mail'i

0

oto fragment kodu: [...] oznacza, że jest tam jeszcze inny kod ale został pominięty bo jest nie potrzebny.
public
[...]
procedure send_mail(subject : string; from : string; toadress : string; text : TStrings; reply_to_my_adress : boolean);
procedure mailslot_initialize(host : string; UserID : string; Port : integer; connect : boolean);
[...]
procedure create_mail_slot;

[...]
procedure send_mail(subject : string; from : string; toadress : string; text : TStrings; reply_to_my_adress : boolean);
begin
create_mail_slot;
if mailcomponent.Connected = true then *2
begin
Mailcomponent.PostMessage.FromAddress := from;
Mailcomponent.PostMessage.FromName := '';
Mailcomponent.PostMessage.Subject := subject;
Mailcomponent.PostMessage.ToAddress.Add(toadress);
Mailcomponent.PostMessage.Body.Assign(text);
if reply_to_my_adress = true then *1
begin
Mailcomponent.PostMessage.ReplyTo := from;
end; *1
Mailcomponent.SendMail; *2
end else
begin
Showmessage('Nie połączony!');
end;
end;

procedure mailslot_initialize(host : string; UserID : string; Port : integer; connect : boolean);
begin
create_mail_slot;
mailcomponent.postmessage.date := datetostr(date);
mailcomponent.PostMessage.LocalProgram := 'ZIOMBER smpt demo';
mailcomponent.TimeOut := 0;
mailcomponent.SubType := mtPlain;
mailcomponent.ClearParams := true;
mailcomponent.EncodeType := uuMime;
Mailcomponent.Charset := 'us-ascii';
Mailcomponent.Host := host;
Mailcomponent.Port := Port;
Mailcomponent.UserID := UserID;
if connect = true then
begin
Mailcomponent.Connect;
end;
end;

procedure create_mail_slot; * [..]
begin
if slot_mail_created = true then
begin

  •                                 :)
    

end else
begin
Mailcomponent := TNMSMTP.Create(nil);
slot_mail_created := true;
end;
end;

I jak mam wszystko ustawione i pisze, ze połączony i chcę wyslac mail'a to mi pokazuje komunikat: "503 5.5.2 Waiting for RCPT command" - mam nadzieję że kod działa :)

0

o ile sie nie myle to te 503.... to server smtp, sprawdz czy istnieje taki server :_)
moge sie mylic tak wiec nie wiem czy Ci pomoge :)
{hello} pozdrawiam {hello}

1 użytkowników online, w tym zalogowanych: 0, gości: 1