Solved

send email

Posted on 2000-03-20
6
176 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
This video discusses moving either the default database or any database to a new volume.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

759 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now