Send email with attachment in C++

前端 未结 5 2007
无人及你
无人及你 2020-12-01 00:10

I am working on a project in C++, which includes a feature of sending information to someone as \'email attachment\'.

Everything is done except this \'email\' thing.

5条回答
  •  旧巷少年郎
    2020-12-01 00:56

    indy also has components for sending emails via SMTP

    TIdSMTP *IdSMTP1 = new TIdSMTP(this);
    IdSMTP1->Host = "myhost";
    IdSMTP1->Port = 25;
    TIdMessage *MSG = new TIdMessage(this);
    MSG->Clear();
    MSG->From->Address = "someone@someone.com";
    MSG->From->Name = "Someone";
    MSG->Subject = "Spy Email";
    MSG->Recipients->EMailAddresses = "Watcher@watch.com";
    MSG->Body->Text = "your being watched ";
    IdSMTP1->Connect();
    IdSMTP1->Send(MSG);
    IdSMTP1->Disconnect(true);
    delete MSG;
    delete IdSMTP1;
    

    and it comes installed with Builder now

提交回复
热议问题