如何與德爾福2010年發送的電子郵件地址,如(verefication電子郵件,密碼丟失,或任何HTML /純文本電子郵件。使用SMTP與Delphi發送電子郵件時連接超時錯誤?
我試着用下面的代碼,但嘗試發送郵件時,我得到EIdSocket Eroor with message 'Socket Error #10060 Connection Timed Out'
。
procedure TForm5.btnSendMailClick(Sender: TObject);
begin
//setup SMTP
smtppass := ed_IdVerification.Text;
SMTP.Host := 'smtp.google.com'; // Controle a distance
SMTP.Port := 465;
smtp.Username := '[email protected]';
smtp.Password := QuotedStr(smtppass);
//setup mail message
MailMessage.From.Address := '[email protected]';
MailMessage.Recipients.EMailAddresses := '[email protected]';
MailMessage.Subject := 'Confirm your account';
MailMessage.Body.Text := 'Text goes here';
//send mail
try
try
if not smtp.Connected then SMTP.Connect() ;
SMTP.Send(MailMessage) ;
except on E:Exception do
ShowMessage(E.Message);
end;
finally
if SMTP.Connected then SMTP.Disconnect;
end;
end;
我不問如何發送匿名或網絡釣魚電子郵件,但我想知道知道如何用Delphi使用SMTP組件,我需要發送驗證郵件,每當一個新的用戶註冊等 – 2011-12-20 14:15:51
什麼錯誤做你得到?編譯器錯誤?運行時錯誤?超時不是編譯器錯誤。你的問題含糊不清,錯過了關於你的實際錯誤的許多細節。此外,您在編輯之前發佈的原始代碼版本使您看起來像是一個Phisher,無論您編輯此帖是多少。 – 2011-12-20 14:39:32
你見過[用Indy發送郵件給GMail](http://www.marcocantu.com/tips/oct06_gmail.html)嗎? – mjn 2011-12-20 14:45:56