[DELPHI] smtp клиент

Discussion in 'С/С++, C#, Rust, Swift, Go, Java, Perl, Ruby' started by Ant1Player, 25 Aug 2009.

  1. Ant1Player

    Ant1Player New Member

    Joined:
    21 Nov 2008
    Messages:
    33
    Likes Received:
    1
    Reputations:
    0
    что делаю не так?

    PHP:
    begin 
       IdSMTP1
    .Host:='smtp.mail.ru';
       
    IdSMTP1.Port:=25;
      
    IdSMTP1.Username:='io';
       
    IdSMTP1.Password:='*****';
       
    IdSMTP1.AuthenticationType:=atLogin;
       
    with IdMessage1 do
          
    begin
            Body
    .Assign(Edit1.text);
            
    From.Text := 'ddd';
            
    Recipients.EMailAddresses := 'dd';
            
    Subject := '==';

            
    end;

          
    IdSMTP1.Connect;
             try
          
    showmessage('Ïðîèçîøëî ïîäêëþ÷åíèå ê ñåðâåðó');
          
    IdSMTP1.Send(IdMessage);
             finally
               
    IdSMTP1.Disconnect;
             
    end;
    ошибка в строчке
    PHP:
     Body.Assign(Edit1.text);
     
  2. Dosia

    Dosia Member

    Joined:
    5 Jun 2009
    Messages:
    118
    Likes Received:
    81
    Reputations:
    6
    #2 Dosia, 25 Aug 2009
    Last edited: 25 Aug 2009
  3. RumShun

    RumShun Member

    Joined:
    27 Oct 2008
    Messages:
    283
    Likes Received:
    75
    Reputations:
    6
    у тебя типы не совподают там не string, а TStrings
    Code:
    var
     bodytext: TStringList;
    begin
     bodytext:=TStringList.Create;
     bodytext.Add(Edit1.text);
     IdSMTP1.Host:='smtp.mail.ru';
     IdSMTP1.Port:=25;
     IdSMTP1.Username:='io';
     IdSMTP1.Password:='*****';
     IdSMTP1.AuthenticationType:=atLogin;
     with IdMessage1 do
      begin
       IdMessage1.Body.Assign(bodytext);
       From.Text := 'ddd';
       Recipients.EMailAddresses := 'dd';
       Subject := '==';
      end;
     IdSMTP1.Connect;
     try
      showmessage('I?iecioei iiaee??aiea e na?aa?o');
      IdSMTP1.Send(IdMessage);
     finally
      IdSMTP1.Disconnect;
     end;
     
    #3 RumShun, 25 Aug 2009
    Last edited: 25 Aug 2009
  4. Ant1Player

    Ant1Player New Member

    Joined:
    21 Nov 2008
    Messages:
    33
    Likes Received:
    1
    Reputations:
    0
    Спасибо! но теперь компилиться нормально а при нажатии на кнопку отправки пишит
    Syntactically invalid HELO argument(s)
    Что это может быть?
     
  5. e4key

    e4key New Member

    Joined:
    24 Jul 2009
    Messages:
    24
    Likes Received:
    1
    Reputations:
    0
    В delphi не шарю, но серверу нужно скзазать helo :)

    IdSMTP1.Helo;

    если не ошибаюсь, то сказать надо сразу после connect'a.
     
  6. !nik!

    !nik! New Member

    Joined:
    24 Aug 2009
    Messages:
    4
    Likes Received:
    2
    Reputations:
    0
    Да-да... вроде надо)
     
  7. Ant1Player

    Ant1Player New Member

    Joined:
    21 Nov 2008
    Messages:
    33
    Likes Received:
    1
    Reputations:
    0
    написал
    IdSMTP1.Helo;
    пишит
    [Error] Unit3.pas(50): Undeclared identifier: 'Helo'

    Пошарился в гугле все примеры без этой строчки...
    как же ее правильно написать..
     
  8. Vlad3d

    Vlad3d Elder - Старейшина

    Joined:
    18 Jan 2008
    Messages:
    47
    Likes Received:
    54
    Reputations:
    -1
    deleted
     
    #8 Vlad3d, 25 Aug 2009
    Last edited: 30 Dec 2010
  9. Ant1Player

    Ant1Player New Member

    Joined:
    21 Nov 2008
    Messages:
    33
    Likes Received:
    1
    Reputations:
    0
    а при idHttp1.Send('helo')
    [Error] Unit3.pas(61): Incompatible types: 'TIdMessage' and 'String'
     
  10. Ant1Player

    Ant1Player New Member

    Joined:
    21 Nov 2008
    Messages:
    33
    Likes Received:
    1
    Reputations:
    0
    ладно, спасибо всем, понел что это тупит mail.ru на рамблере не просит не каких хело..
     
  11. HakaR

    HakaR Active Member

    Joined:
    23 Jul 2009
    Messages:
    301
    Likes Received:
    200
    Reputations:
    3
    Ну и молодец!:)
     
    4 people like this.
  12. RumShun

    RumShun Member

    Joined:
    27 Oct 2008
    Messages:
    283
    Likes Received:
    75
    Reputations:
    6
    кодер блин...