Why don't you use components like TMail2000 and send HTML formated emails (u can show links, pictures,...)
The components are very simple to use... More about TMail2000: http://groups.yahoo.com/group/tmail2000/ Aris, www.slohost.net -----Original Message----- From: Jerry [mailto:[EMAIL PROTECTED] Sent: Friday, January 06, 2006 1:14 AM To: [email protected] Subject: Sending and e-mail in Delphi Can anyone help with this problem I'm having. I'm writing, or should I say, I'm trying to write a procedure into my application that will send an e-mail automatically to a particular person. When I say automatically, I mean without USER INTERVENTION. This is the code, below, for the function I'm using and although it will allow me to create and send an e-mail, it is the sending part that is causing me trouble. It pops up the e-mail window complete with all fields filled out, including the body of the e-mail but it requires the user to click on SEND to finally send it. I need to have no intervention at all and hope some one can help me achieve this. I feel the problem lies with the flags in this line of code.... Result := SM(0, Application.Handle, Message,MAPI_DIALOG or MAPI_LOGON_UI,0); which I have changed to this Result := SM(0, Application.Handle, Message,0,0); but it still requires user intervention. ---------------------------------------------------------------------------- -------------------------------------- function SendMail(const Subject, Body, FileName, SenderName, SenderEMail, RecepientName, RecepientEMail: string): Integer; var Message: TMapiMessage; lpSender, lpRecepient: TMapiRecipDesc; FileAttach: TMapiFileDesc; SM: TFNMapiSendMail; MAPIModule: HModule; begin FillChar(Message, SizeOf(Message), 0); with Message do begin if (Subject <> '') then lpszSubject := PChar(Subject); if (Body <> '') then lpszNoteText := PChar(Body); if (SenderEmail <> '') then begin lpSender.ulRecipClass := MAPI_ORIG; if (SenderName = '') then lpSender.lpszName := PChar(SenderEMail) else lpSender.lpszName := PChar(SenderName); lpSender.lpszAddress := PChar(SenderEmail); lpSender.ulReserved := 0; lpSender.ulEIDSize := 0; lpSender.lpEntryID := nil; lpOriginator := @lpSender; end; if (RecepientEmail <> '') then begin lpRecepient.ulRecipClass := MAPI_TO; if (RecepientName = '') then lpRecepient.lpszName := PChar(RecepientEMail) else lpRecepient.lpszName := PChar(RecepientName); lpRecepient.lpszAddress := PChar(RecepientEmail); lpRecepient.ulReserved := 0; lpRecepient.ulEIDSize := 0; lpRecepient.lpEntryID := nil; nRecipCount := 1; lpRecips := @lpRecepient; end else lpRecips := nil; if (FileName = '') then begin nFileCount := 0; lpFiles := nil; end else begin FillChar(FileAttach, SizeOf(FileAttach), 0); FileAttach.nPosition := Cardinal($FFFFFFFF); FileAttach.lpszPathName := PChar(FileName); nFileCount := 1; lpFiles := @FileAttach; end; end; MAPIModule := LoadLibrary(PChar(MAPIDLL)); if MAPIModule = 0 then Result := -1 else try @SM := GetProcAddress(MAPIModule, 'MAPISendMail'); if @SM <> nil then begin Result := SM(0, Application.Handle, Message,0,0); end else Result := 1; finally FreeLibrary(MAPIModule); end; if Result <> 0 then MessageDlg('Error sending mail (' + IntToStr(Result) + ').', mtError, [mbOK], 0); end; ---------------------------------------------------------------------------- ----------------- SendMail('Re: Happy Birthday', // subject line 'McCambridge Duffy would like to wish you'#13#10+tmp4+ // body of message ' A Very Happy Birthday! '#13#10+IntToStr(Age)+ // body of message ' years old. C O N G R A T U L A T I O N S ! '#13#10+ // body of message ' Click this link, http:\\www.ourplace.com\'ecard.html, to View your Birthday Card', // body of message ' ', // file attachment if any 'IT Dept', '[EMAIL PROTECTED]', // from sender name and sender e-mail address 'Birthday Girl', '[EMAIL PROTECTED]'); // to Recipient Name and Reciepient e-mail ---------------------------------------------------------------------------- --------------------------------- The other thing I'd like to be able to do is send a clickable URL link within the body of the message so that the recipient can click it to get to where we want him/her to go to. Any help would be appreciated . Many thanks. Regards Jerry _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi _______________________________________________ Delphi mailing list -> [email protected] http://www.elists.org/mailman/listinfo/delphi

