mail yollamak

Delphi'de kod yazma ile ilgili sorularınızı bu foruma yazabilirsiniz.
Cevapla
maqro
Üye
Mesajlar: 132
Kayıt: 11 Eki 2005 10:59

mail yollamak

Mesaj gönderen maqro »

s.a

şöyle bir mail yollama kodu yazdım ama yolla diyince mail gitmiyo hatafalanda wermiyo kod şöyle

procedure TForm1.Button1Click(Sender: TObject);
begin
idsmtp1.Username:= 'xxx@hotmail.com';
idsmtp1.HeloName:= 'xxx@hotmail.com';
idsmtp1.Password:= 'xxx';
idsmtp1.Host:= 'mail.hotmail.com';
idsmtp1.Port:= 25;

idmessage1.From.Address:= idsmtp1.Username;
idmessage1.Recipients.EMailAddresses:='yyy@hotmail.com';
idmessage1.Subject:='deneme';
idmessage1.Body.Text:='deneme';
try
try
idsmtp1.Connect(1000);
idsmtp1.Send(idmessage1);
except on E:exception do

end;
finally
if idsmtp1.Connected then idsmtp1.Disconnect;
end;
end;

BU KOD NİYE MAİL YOLLAMIYOR ANLAMADIM YARDIM EDERSENİZ ÇOK MAKBULE GEÇER:) yada farklı ir mail yollama kodu warsa elinizde oda yardımcı olur maksadım mail yollamak...[/code]
Kullanıcı avatarı
huseyinert
Üye
Mesajlar: 233
Kayıt: 19 Nis 2005 06:49
Konum: Bartın

Mesaj gönderen huseyinert »

aşağıdaki kod mail gönderiyor fakat hotmail,yahoo,gmail gibi mail adresleriine mail gönderen kişi olamıyorsun ama mail alan kişi olabiliyorsun, gönderen şirket web site vb. olması gerekiyor pop3 le ilgili olması gerekiyor bununda. kolay gelsin

Kod: Tümünü seç

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, IdMessage, IdBaseComponent, IdComponent, IdTCPConnection,
  IdTCPClient, IdMessageClient, IdSMTP;

type
  TForm1 = class(TForm)
    GroupBox1: TGroupBox;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Memo1: TMemo;
    Button1: TButton;
    Button2: TButton;
    Button3: TButton;
    IdSMTP1: TIdSMTP;
    IdMessage1: TIdMessage;
    OpenDialog1: TOpenDialog;
    procedure Button3Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    { Déclarations privées }
  public
    { Déclarations publiques }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button3Click(Sender: TObject);
begin
Close;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Edit3.Text:=OpenDialog1.FileName;
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
IdMessage1.Clear;
IdMessage1.From.Text :=Edit1.Text;
IdMessage1.ReplyTo.EMailAddresses:=Edit1.Text;
IdMessage1.Recipients.EMailAddresses:=Edit2.Text;
IdMessage1.Date:=Date;
IdMessage1.Subject:=Edit4.Text;
IdMessage1.Priority:=mpNormal;
if not (Edit3.Text=") then TIdAttachment.Create(IdMessage1.MessageParts,Edit3.Text); IdMessage1.Body.Assign(Memo1.Lines);
//Connexion au serveur smtp
IdSMTP1.AuthenticationType:=atLogin;
IdSMTP1.Host:='xxxx';
IdSMTP1.Port:=25;
IdSMTP1.UserName:='xxxx';
IdSMTP1.Password:='xxxx';
IdSMTP1.Connect;
try
IdSMTP1.Send(IdMessage1);
finally
IdSMTP1.Disconnect;
end;
end;

end.
"Kula bela gelmez Hak yazmayınca,Hak bela yazmaz kul azmayınca..." MEVLANA
Kullanıcı avatarı
mussimsek
Admin
Mesajlar: 7604
Kayıt: 10 Haz 2003 12:26
Konum: İstanbul
İletişim:

Mesaj gönderen mussimsek »

Merhaba,

önce Thunderbird, Outlook Express gibi bir araçla mail göndermeyi deneyin ve başarılı olduğunuzda koda ayarları yansıtın.

1. Arama yaparsanız bu konu çok konuşuldu.

2. Hotmail bildiğim kadarıyla smtp desteği vermiyor? Eğer son zamanlarda bir değişiklik olmadı ise gönderememeniz normal. SMTP desteği olan bir mail edinip öyle deneyin. Gmail'in SMTP desteği var.

Kolay gelsin.
Kullanıcı avatarı
Serim
Üye
Mesajlar: 194
Kayıt: 08 Ara 2004 03:32
Konum: Konya

Mesaj gönderen Serim »

Eğer hotmail, yahoo gibi adreslerede mail göndermek istiyorsanız outlook express ide deneyebilirsiniz :wink:

uses kısmına shellapi eklemeyi unutmayın..

Kod: Tümünü seç

ShellExecute(application.MainForm.Handle,nil,'mailto:','','',0);
kolay gelsin..
Bilginin temelini sağlam at depremde zarar görmesin
Cevapla