Solved

send email

Posted on 2000-03-20
6
183 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Delphi 2 77
Tidtcpserver listening on multiports? 1 45
Twebbrowser add css to the header 3 39
can i put an image from resource into image tag ? 6 31
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

749 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