Mega Code Archive

 
Categories / Delphi / Examples
 

Email

Subject: RE: Sending e-mail from Delphi App >I am new to delphi, however I am wonder if it is possible to send >an e-mail automatically from a Delphi application. I also need >to be able to attach a file at the same time. There are a lot of variations around the EMail theme... If you are looking for internet like EMail, then you need a SMTP component (Simple Mail Transfer Protocol). I made one which is freeware, include full source code and is part of the ICS collection. Download source code from http://www.rtfm.be/fpiette/indexuk.htm and look at MailSnd sample program. -- francois.piette@pophost.eunet.be The author of the freeware Internet Component Suite and freeware middleware MidWare http://www.rtfm.be/fpiette/indexuk.htm **************************************************** If you don't want to see any more of these messages, send a message to: MajorDomo@Kyler.com with a message of: UNSUBSCRIBE delphi You could also try the Internet components at this site : http://www.neosoft.com/~startech I found the SendMailDialog very easy to use ... e.g. with SM do begin SMTP_Server:=MainForm.SMTP_Server; From_Name:='"'+StaffTblST_Name.Value+'"'; From_Address:=StaffTblST_eMail.Value; Subject:=DealNo; ListTo.Clear; ListTo.Add(MainForm.POSADMIN+'|POSADMIN'); StaffTbl.FindKey([DealSelForm.wwQuery1DH_Dealer.Value]); ListTo.Add(StaffTblST_eMail.Value+'|Dealer'); MailText.Clear; MailText.Add(ReasonStr); Attachments.Clear; Attachments.Add('c:\autoexec.bat'); Execute; end; It brings up a dialog box that shows you a gauge with the time left to send ... Sandy OR Charles, Look for the TEmail component from (I think) the DSP. It handles email through MAPI and will handle attachments according to the documentation. ************************************************************************ SEND EMAIL VIA THE DEFAULT CLIENT Try this. I got this from this list in March but have not tested it myself. Certainly there is a lot of confusion in this area mailto:username@domain&body="c:\autoexec.bat" This format was also suggested mailto:username@domain?subject=Attachment Example&body="c:\autoexec.bat" HTH, Stephen BUT If you want to attach files, then you have to use MAPI. All Microsoft email clients support MAPI. ************************************************************************************** Are you willing to try other e-mail components..? If so, you could use something like Mail2000 which you will be able to find at Torry's Delphi Pages (www.torry.ru). **************************************************************************************