sorunum aynen goruldugu gibi
Kod: Tümünü seç
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
IdTCPClient, IdMessageClient, IdSMTP, StdCtrls;
type
TForm1 = class(TForm)
MailMessage: TIdMessage;
SMTP: TIdSMTP;
Button1: TButton;
procedure ConnectMail;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
SentMail: Boolean;
public
{ Public declarations }
end;
const
SmtpUser : string = 'smtp_user=' + 'neropower@hotmail.com ';
SmtpHost: string = 'smtp_host=' + 'mx3.hotmail.com ';
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ConnectMail;
begin
//Yukarida bulunan SmtpHost da yazılı olan hostun adını nasıl aldırabilirim
//mesela Trim(Copy ile smtp host adını aşağıdaki yere yazdıırıp mail gondermek
//istiyorum
SMTP.Host := Trim(Copy(SmtpHost,30,Length(SmtpHost)));
SMTP.Port := 25;
MailMessage.From.Address := 'gonderenmailadresi@hotmail.com';
//Const satırı altında bulunanan smtpuser deki mail adresini nasıl aşağıya yazdırabilirim.
//mesela neropower@hotmail.com ismli mail adresini aşağıdaki trim(copy satırına nasıl kopyalatıp
//mail gonderebilirim
MailMessage.Recipients.EMailAddresses := Trim(Copy(SmtpUser,30,Length(SmtpUser)));
MailMessage.Subject := 'konu baslıgı';
MailMessage.Body.Text := 'yazacagımız yazı metni';
SMTP.Connect(1000);
SMTP.Send(MailMessage);
if smtp.Connected then smtp.Disconnect;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
ConnectMail;
end;
end.
** kodları [ CODE ] tagı içine alın.