各位大哥,小弟最近做了一个东东,要求用Delphi开发一个程序能收发E-mail,但小弟学浅,不知怎样得到邮箱服务器、用户名、密码什么的,小弟的邮箱有yahoo的也有gmail的,不知支持不支持呀?
解决方案 »
- 为IDWB,tjianliang 等几位朋友散分
- delphi中,DBGrid导出成Excel或者直接打印
- 关于用户密码登录的问题
- 单位要开发一个WEB站点,该用什么工具开发好.
- delphi7中没有fastnet,该怎么添加,或能用什么代替,谢谢回复!
- 这个问题怎么解决
- 高手进来就有分得!!!!!!!!!!!!!
- 急!D6的——条码打印控件,希各位大虾帮忙!!
- 有哪们大哥知道怎么用DELPHI得到有关硬盘的资料--->具体请进来
- 如果要带一个项目组应该具有哪些知识? 欢迎大家讨论!
- 很简单的语法问题,谁能帮我修改一下
- 高手指点memo中sellength有时汉字长度为1,有时为2,在那里进行设置?
假设 那么服务器是否可以写成mail.gmail.com 帐号写成aaaaa呢?
try
IdSMTP1.Host := 'SMTP.163.com';
IdSMTP1.Username := '11111';
IdSMTP1.Password := '11111';
IdSMTP1.Port := 25 ; IdMessage1.From.Address := '[email protected]';
IdMessage1.Recipients.EMailAddresses:='[email protected]';
IdMessage1.Subject:= '第一个邮件客户端';
IdMessage1.Body.Text := Memo1.Text;
if IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then
begin
IdSMTP1.AuthenticationType := atLogin;
// IdSMTP1.Authenticate;
end; IdSMTP1.Connect();//正常
IdSMTP1.Send(IdMessage1);//弹出EIOProtocolReplyError异常 不知为什么?
except
IdSMTP1.Disconnect;
end;
IdSMTP1.Password := '11111';
用户名:11111,密码:11111,
你在163的账号?
如果不是,先到163申请账号,再填写在这里,
function EncodeBase64(const Source: string): string;
const
BaseTable = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var
Times, LenSrc, i: Integer;
x1, x2, x3, x4: Char;
xt: Byte;
begin
Result := '';
LenSrc := Length(Source);
if LenSrc mod 3 = 0 then Times := LenSrc div 3
else Times := LenSrc div 3 + 1; for i := 0 to Times - 1 do
begin
if LenSrc >= (3 + i * 3) then
begin
x1 := BaseTable[(ord(Source[1 + i * 3]) shr 2)+1];
xt := (ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
xt := xt or (Ord(Source[3 + i * 3]) shr 6);
x3 := BaseTable[xt + 1];
xt := (ord(Source[3 + i * 3]) and 63);
x4 := BaseTable[xt + 1];
end
else if LenSrc >= (2 + i * 3) then
begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2) + 1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
xt := xt or (Ord(Source[2 + i * 3]) shr 4);
x2 := BaseTable[xt + 1];
xt := (Ord(Source[2 + i * 3]) shl 2) and 60;
x3 := BaseTable[xt + 1];
x4 := '=';
end
else begin
x1 := BaseTable[(Ord(Source[1 + i * 3]) shr 2)+1];
xt := (Ord(Source[1 + i * 3]) shl 4) and 48;
x2 := BaseTable[xt + 1];
x3 := '=';
x4 := '=';
end;
Result := Result + x1 + x2 + x3 + x4;
end;
end;procedure TForm1.NMSMTP1OnConnect(Sender: TObject);
begin
if NMSMTP1.ReplyNumber = 250 then NMSMTP1.Transaction('auth login');
if NMSMTP1.ReplyNumber = 334 then
begin
NMSMTP1.Transaction(EncodeBase64(UserID)); //用户名比如: [email protected],就是abc
NMSMTP1.Transaction(EncodeBase64(Password));//邮箱密码
end;
end;
有哪位高手帮我看看这个程序有什么问题,小弟急呀,谢了:
try
IdSMTP1.Host := 'SMTP.163.com';
IdSMTP1.Username := 'caoyan_528'; //邮件的用户名,必须是真实的
IdSMTP1.Password := 'pas'; //邮件的密码,必须是真实的
IdSMTP1.Port := 25 ; IdMessage1.From.Address := '[email protected]';
IdMessage1.Recipients.EMailAddresses:='[email protected]';
IdMessage1.Subject:= '第一个邮件客户端';
IdMessage1.Body.Text := Memo1.Text;
if IdSMTP1.AuthSchemesSupported.IndexOf('LOGIN')>-1 then
begin
IdSMTP1.AuthenticationType := atLogin;
// IdSMTP1.Authenticate;
end; IdSMTP1.Connect();//正常
IdSMTP1.Send(IdMessage1);//弹出EIOProtocolReplyError异常 不知为什么?
except
IdSMTP1.Disconnect;
end;
IdPOP31.Connect();
mailcount := IdPOP31.CheckMessages;
for i:=1 to mailcount do
begin
IdMessage2.Clear;
IdPOP31.retrieveHeader(i,IdMessage2);
tmp := IdMessage2.Subject;
Memo1.Lines.Add(tmp);
tmp := IdMessage2.
memo1.Lines.Add(IdMessage2.Body.Text); //内容为空,小弟想显示邮件内容
end;
IdPOP31.Disconnect;
请问各位,如何才能下载到邮件的内容呀?