Merhaba Arkada$Lar Hazırlamı$ Olduğum Bir Program Var Bu Programda Raporları Excel Formatında Kaydettiriyorum Ve Bunları Otomatik Olarak Bir Butona Koyup Mail Göndermek İstiyorum Fakat Forumdaki Mail Gönderme İle İlgili Olarak Olan Kodlar Arasında Bir Türlü Xls Dosyasını Attachment Olarak Gönderebileceğim Bir Kod Bulamadım..? Böyle Bir Mail Gönderme Olayını Nasıl Yapabilirim? Herkeze İyi Çalı$Malar...
lütfen küçük harfler ile...
Attachment'li mail gönderme..?
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
Kod: Tümünü seç
procedure TMailerForm.btnSendMailClick(Sender: TObject);
var
mail:string;
konum:integer;
begin
if (company.Text<>'') and (contact.Text<>'') and (phone.Text<>'') and (fax.Text<>'') and (email.Text<>'') and (pos('@',email.Text)<>0) then
begin
statusmemo.Visible:=true;
animate2.Visible:=true;
animate2.StartFrame:=1;
animate2.Active:=true;
animate1.Visible:=true;
animate1.Parent:=btnsendmail;
konum:=btnsendmail.Height-animate1.Height;
animate1.SetBounds(konum div 2,konum div 2, animate1.Width,animate1.Height);
animate1.Active:=true;
StatusMemo.Clear;
mail:='Company:'+chr(32)+company.Text+chr(13)+'Contact Person:'+chr(32)+contact.Text+chr(13)+'Phone:'+chr(32)+phone.Text+chr(13)+'Fax:'+chr(32)+fax.Text+chr(13)+'Email:'+chr(32)+email.Text+chr(13)+'Adress:'+chr(32)+adress.Text+chr(13)+'Country:'+chr(32)+country.text+chr(13)+'City:'+chr(32)+city.Text+chr(13)+'Notes:'+chr(32)+chr(13)+notes.Text+chr(13);
//setup SMTP
try
SMTP.Host :='host ipsi veya ismi';//smtp.e-kolay.net gibi
SMTP.Port := 25;
except on E:EAccessViolation do
begin
Showmessage('System error');
end;
end;
//setup mail message
MailMessage.From.Address :='Buraya hangi hesaptan göndermek istiyorsan onu yaz veya edit'e aktar' ;
MailMessage.Recipients.EMailAddresses :='Buraya gidecek mail adresleri belirtilecek' ;
MailMessage.Subject := 'Konu kısmı';
MailMessage.Body.Text := mail;
way:=way+'order_spare.xls'; //Attach etmek istediğin excel dosyasının ismi
TIdAttachment.Create(mailmessage.MessageParts,way);
try
try
if smtp.Authenticate then
begin
smtp.AuthenticationType:=atlogin;
end;
smtp.Username:='Smtp kullanıcı adınız';
smtp.Password:='Parolanız';
try
SMTP.Connect(1000);
except
Messagedlg('There is no internet connection',mtwarning,[mbok],0);
end;
try
SMTP.Send(MailMessage);
animate1.Active:=false;
animate1.Visible:=false;
animate2.Active:=false;
animate2.Stop;
statusmemo.Visible:=false;
animate2.Visible:=false;
Messagedlg('Your order has been send',mtinformation,[mbok],0);
except
animate1.Active:=false;
animate1.Visible:=false;
animate2.Active:=false;
animate2.Stop;
statusmemo.Visible:=false;
animate2.Visible:=false;
Messagedlg('Your order not has been send',mtinformation,[mbok],0);
end;
except on E:Exception do
StatusMemo.Lines.Insert(0, 'ERROR: ' + E.Message);
end;
finally
if SMTP.Connected then
begin
SMTP.Disconnect;
way:='';
// smtp.Free;
mailmessage.MessageParts.Clear;
// mailmessage.Free;
end;
end;
end; (* btnSendMail Click *)
end;
Bilginin efendisi olmak için çalışmanın uşağı olmak şarttır...
BALZAC
Bana bir harf öğretenin kulu kölesi olurum..
HZ.ALİ
BALZAC
Bana bir harf öğretenin kulu kölesi olurum..
HZ.ALİ