۱۸-خرداد-۱۳۸۵, ۰۴:۰۱:۳۴
۲۰-خرداد-۱۳۸۵, ۰۷:۲۳:۵۲
برای فرستادن mail باید از idsmtp از کامپوننتهای indyclientاستفاده کنی وبرای متن mailاز idmessageواگه با فایل خواستی بفرستی idattechment
برای چک کردن mailهم باید از pop3 استفاده کنی
این برای ارسال mail هستش خیلی وقت پیش نوشتم ببین به دردت میخوره به یه کمی تغییر احتیاج داره فکر کنم
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, ToolWin, ComCtrls;
type
TForm1 = class(TForm)
ToolBar1: TToolBar;
Button1: TButton;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
Memo1: TMemo;
Label1: TLabel;
Edit1: TEdit;
Button2: TButton;
Label2: TLabel;
Edit2: TEdit;
OpenDialog1: TOpenDialog;
Label3: TLabel;
Edit3: TEdit;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
idmessage1.Body.Add(memo1.Text);
idmessage1.From.Text:='ghoroobe_delangiz2002@yahoo.com.com';
idmessage1.Recipients.EMailAddresses:=edit1.Text;
idmessage1.Subject:='salam';
if edit2.Text>''then
begin
tidattachment.Create(idmessage1.MessageParts,edit1.Text);
end;
idsmtp1.Host:= edit3.Text;
idsmtp1.Connect();
statusbar1.SimpleText:='connect to server';
try
idsmtp1.Send(idmessage1);
statusbar1.SimpleText:='sending mail...';
finally
idsmtp1.Disconnect;
statusbar1.SimpleText:='done!';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
edit2.Text:=opendialog1.FileName;
end;
//for yahoo hostname==mx1.mail.yahoo.com//
end.
برای چک کردن mailهم باید از pop3 استفاده کنی
این برای ارسال mail هستش خیلی وقت پیش نوشتم ببین به دردت میخوره به یه کمی تغییر احتیاج داره فکر کنم
unit Unit4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, IdMessage, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdMessageClient, IdSMTP, ToolWin, ComCtrls;
type
TForm1 = class(TForm)
ToolBar1: TToolBar;
Button1: TButton;
IdSMTP1: TIdSMTP;
IdMessage1: TIdMessage;
Memo1: TMemo;
Label1: TLabel;
Edit1: TEdit;
Button2: TButton;
Label2: TLabel;
Edit2: TEdit;
OpenDialog1: TOpenDialog;
Label3: TLabel;
Edit3: TEdit;
StatusBar1: TStatusBar;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
idmessage1.Body.Add(memo1.Text);
idmessage1.From.Text:='ghoroobe_delangiz2002@yahoo.com.com';
idmessage1.Recipients.EMailAddresses:=edit1.Text;
idmessage1.Subject:='salam';
if edit2.Text>''then
begin
tidattachment.Create(idmessage1.MessageParts,edit1.Text);
end;
idsmtp1.Host:= edit3.Text;
idsmtp1.Connect();
statusbar1.SimpleText:='connect to server';
try
idsmtp1.Send(idmessage1);
statusbar1.SimpleText:='sending mail...';
finally
idsmtp1.Disconnect;
statusbar1.SimpleText:='done!';
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if opendialog1.Execute then
edit2.Text:=opendialog1.FileName;
end;
//for yahoo hostname==mx1.mail.yahoo.com//
end.
۲۶-خرداد-۱۳۸۵, ۰۰:۰۱:۱۱
برای دریافت mailاز یک سرور باید ازidpop3استفاده کنی
procedure TForm1.Button1Click(Sender: TObject);
var FMsgCount: integer;
var intIndex: integer;
var i: integer;
begin
memo1.Clear;
idPOP31.Host := 'pop.mail.de';
//idPOP.Port := Pop3ServerPort;
idPOP31.Username := 'mustermann@provider.de';
idPOP31.Password := 'xyzpasswort';
idPOP31.Connect;
FMsgCount := idPOP31.CheckMessages;
label2.Caption:=inttostr(FMsgCount);
//for i:=1 to FMsgCount do
//begin
//POP.Retrieve(i, IdMessage1);
idPOP31.Retrieve(strtoint(edit1.text), IdMessage1);
for intIndex := 0 to Pred(IdMessage1.MessageParts.Count) do begin
if (IdMessage1.MessageParts.Items[intIndex] is TIdAttachment) then
begin
memo1.lines.add(TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
end;
end;
//end;
idpop31.disconnect;
end;
end.
procedure TForm1.Button1Click(Sender: TObject);
var FMsgCount: integer;
var intIndex: integer;
var i: integer;
begin
memo1.Clear;
idPOP31.Host := 'pop.mail.de';
//idPOP.Port := Pop3ServerPort;
idPOP31.Username := 'mustermann@provider.de';
idPOP31.Password := 'xyzpasswort';
idPOP31.Connect;
FMsgCount := idPOP31.CheckMessages;
label2.Caption:=inttostr(FMsgCount);
//for i:=1 to FMsgCount do
//begin
//POP.Retrieve(i, IdMessage1);
idPOP31.Retrieve(strtoint(edit1.text), IdMessage1);
for intIndex := 0 to Pred(IdMessage1.MessageParts.Count) do begin
if (IdMessage1.MessageParts.Items[intIndex] is TIdAttachment) then
begin
memo1.lines.add(TIdAttachment(IdMessage1.MessageParts.Items[intIndex]).Filename);
end;
end;
//end;
idpop31.disconnect;
end;
end.
۲۴-تير-۱۳۸۵, ۰۶:۵۵:۱۲
جدیدا انگار پورت 25 را بستن
من هرچی میل تو اصفهان و قم با پورت 25 فرستادم خطای 110053 می ده
من هرچی میل تو اصفهان و قم با پورت 25 فرستادم خطای 110053 می ده