Solved

send email

Posted on 2000-03-20
6
184 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

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!

Question has a verified solution.

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

Suggested Solutions

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

734 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