Solved

send email

Posted on 2000-03-20
6
182 Views
Last Modified: 2010-04-04
I want to send e-mail to a given recipient. The problem is that there should be a file attached. I use mailto, but don't know how to attach the file.
0
Comment
Question by:simoraikov
6 Comments
 
LVL 12

Expert Comment

by:rwilson032697
ID: 2635514
You can't send an attachment using ShellExecute.

There is good example in delphi\demos\intenet\smtp directory of how to send an email with attachments.

Here is a piece of code Barry (inthe) has posted before showing how to do it:


procedure TForm1.Button1Click(Sender: TObject);
begin
  if not(nmsmtp1.Connected)
  then begin
    nmsmtp1.Host:= 'mail.enterprise.net';
    nmsmtp1.UserID := 'your userid';
    nmsmtp1.Connect;
  end;

  if nmsmtp1.Connected
  then
  begin
    nmsmtp1.ClearParams := True;
    nmsmtp1.SubType := mtPlain;
    nmsmtp1.EncodeType := uuMime;
    nmsmtp1.PostMessage.FromAddress := 'Legend@Enterprise.Net';
    nmsmtp1.PostMessage.ReplyTo := nmsmtp1.PostMessage.FromAddress;
    nmsmtp1.PostMessage.FromName := 'Barry';
    nmsmtp1.PostMessage.ToAddress.Add('BorgsAssmilate@Aol.Com');
    nmsmtp1.PostMessage.Body.AddStrings(Memo1.lines);
    nmsmtp1.PostMessage.Subject := 'A Test';
    nmsmtp1.PostMessage.Date := DateToStr(Date);
    nmsmtp1.SendMail;
    MessageDlg('Mail sent', mtInformation, [mbOk], 0);
  end
  else
    MessageDlg('NOT connected', mtInformation, [mbOk], 0);
end;

Cheers,

Raymond.
0
 
LVL 1

Author Comment

by:simoraikov
ID: 2635528
I want to do it using Outlook !
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2635591
Perhaps this is what you are looking for:

http://www.djpate.freeserve.co.uk/AutoOutl.htm
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 15

Accepted Solution

by:
simonet earned 100 total points
ID: 2635594
Here it goes:

1) Set Outlook as the Default MAPI client. One of the options in Outlook is to make the default MAPI program.

2) Go to http://www.bhnet.com.br/~simonet/howtoprojs.htm and download the "How to send e-mail and faxes from your Delphi/C++ Builder application" sample application. In it you'll find full source, well documented code on how to use MAPI to send e-mail.

Yours,

Alex
0
 
LVL 13

Expert Comment

by:Epsylon
ID: 2635812
I think that the solution I pointed at in my previous comment offers you more control over outlook.
0
 
LVL 1

Author Comment

by:simoraikov
ID: 2635861
Right. I'll make a new 100p question for you. Just answer it!!

10x
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Mydac connection data base issue 3 166
Delphi TcxGrid group footer summary 3 313
Virtuailstring tree compare node issue 14 125
Working with hours 3 64
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

766 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question