Board index » delphi » Sending Email & ShellExecute help...

Sending Email & ShellExecute help...

Hi,

Using D4 C/S P3.

I know how to send email using ShellExecute, but how can I add a
subject, body & attachment to the email using ShellExecute.

This is what I have tried as suggested by someone in an earlier
posting:

ShellExecute(0,
             'open',
             'mailto:My Name <u...@host.com>?Subject=Some
        Subject&body=Some Body',
             '',
             '',
             SW_SHOWNORMAL);

All this does is adds "My Name <u...@host.com>?Subject=Some
Subject&body=Some Body'" to the To: section.

I need the ability to create an email with a subject, body &
attachements with my app using the default email clinet.

Can someone help here?

Many thanks,

Robbie...

 

Re:Sending Email & ShellExecute help...


I downloaded some components from either the Delphi Super Page or Torry
which are used for email.

SakEmail components Version 2.6.1
    Copyright ? 1997, 1998, 1999 Sak
    Sergio Kessler
    email: sakem...@perio.unlp.edu.ar (subscribe first)
    web: http://sak.org.ar

It contains good examples of sending emails with attachments.
--
Mike Best Programming
Brisbane
Australia

Quote
Robbie <lucidtech.RemoveT...@ozemail.com.au> wrote in message

news:38975eb6.3191759@news.ozemail.com.au...
Quote
> Hi,

> Using D4 C/S P3.

> I know how to send email using ShellExecute, but how can I add a
> subject, body & attachment to the email using ShellExecute.

> This is what I have tried as suggested by someone in an earlier
> posting:

> ShellExecute(0,
>              'open',
>              'mailto:My Name <u...@host.com>?Subject=Some
> Subject&body=Some Body',
>              '',
>              '',
>              SW_SHOWNORMAL);

> All this does is adds "My Name <u...@host.com>?Subject=Some
> Subject&body=Some Body'" to the To: section.

> I need the ability to create an email with a subject, body &
> attachements with my app using the default email clinet.

> Can someone help here?

> Many thanks,

> Robbie...

Re:Sending Email & ShellExecute help...


Robbie,

you can't create an e-mail message with attachment using ShellExecute. You
must use the OLE. For example, for Outlook:

const olMailItem = 0;
var Outlook: OLEVariant;
     MailItem: Variant;
begin
  try
    Outlook := GetActiveOleObject('Outlook.Application');
  except
    Outlook := CreateOleObject('Outlook.Application');
  end;

  MailItem := Outlook.CreateItem(olMailItem);
  MailItem.Recipients.Add('mshkol...@rs-ukraine.kiev.ua');
  MailItem.Subject := 'your subject';
  MailItem.Body := 'Welcome to my homepage:
http://www.geocities.com/mshkolnik';
  MailItem.Attachments.Add('yourFileNameWithFullPath');
  MailItem.Send;

  Ooulook := Unassigned;
end;

--
With best regards, Mike Shkolnik.
E-Mail: mshkol...@rs-ukraine.kiev.ua
        mshkol...@yahoo.com
WEB: http://www.geocities.com/SiliconValley/Grid/3989
          http://www.geocities.com/mshkolnik

Robbie ??? a ???? <38975eb6.3191...@news.ozemail.com.au> ...

Quote
>Hi,

>Using D4 C/S P3.

>I know how to send email using ShellExecute, but how can I add a
>subject, body & attachment to the email using ShellExecute.

>This is what I have tried as suggested by someone in an earlier
>posting:

>ShellExecute(0,
>             'open',
>             'mailto:My Name <u...@host.com>?Subject=Some
> Subject&body=Some Body',
>             '',
>             '',
>             SW_SHOWNORMAL);

>All this does is adds "My Name <u...@host.com>?Subject=Some
>Subject&body=Some Body'" to the To: section.

>I need the ability to create an email with a subject, body &
>attachements with my app using the default email clinet.

>Can someone help here?

>Many thanks,

>Robbie...

Other Threads