Call email client and provide address & body & subject

Can I call an email program from Delphi (I don't want to use the SMTP component) and specify a body and subject and of course address?

I will be using Outlook exclusively, so if that helps we can do that.

If we need more points let me know.
loucksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DrDelphiCommented:
use ShellExecute.

Example:
*make sure to include ShellAPI*
ShellExecute(handle,'open','Mailto:somebody@somewhere.com?Subject=Hiya!?Body=This is a test',nil,nil,SW_SHOWNORMAL);
0
loucksAuthor Commented:
Ummm.. I'm sure that will work... Please submit that as an answer so I can grade it.
0
intheCommented:
hi,
well you can do stuff like this:

procedure TForm1.Button1Click(Sender: TObject);
Var
Buffer : String;
recip,subj,mess : String;
begin
recip:= Edit1.text;   {message recipients email address}
subj:=Edit2.Text;     {message subject}
Mess:= Memo1.Text;    {message}
Buffer:='mailto:'+recip+'?subject='+subj+'&body='+mess;
ShellExecute(Application.Handle,'open',PChar(Buffer),nil,nil,SW_Normal);
Sleep(500);              {give mail prog time to open}
keybd_Event(VK_MENU, 0, 0, 0);  {get email prog menu}
keybd_Event(ord('S'), 0, 0, 0);  {s for send}
keybd_Event(ord('S'), 0, KEYEVENTF_KEYUP, 0); {click}
keybd_Event(VK_MENU, 0, KEYEVENTF_KEYUP, 0);  {exit menu}
Edit1.Clear;        
Edit2.Clear;     {and clean up}
Memo1.Clear;      
end;

This will take the params (recipient,subject,and message)and send the mail
 if you are connected to server if your not connected it places mail in outbox folder


or take a look at this example :
http://www.bhnet.com.br/~simonet/archive/mapimail.zip

Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

intheCommented:
snap
0
DrDelphiCommented:
WHO should post it as an answer?
0
loucksAuthor Commented:
This is exactly what I wanted...  DrDelphi I will give you your points too...
0
DrDelphiCommented:
Gracias, amigo!
0
loucksAuthor Commented:
DrDelphi look at the new question I made for you...
0
intheCommented:
very generous of you thanks :-))
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.