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?
 
intheConnect With a Mentor Commented:
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
 
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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
All Courses

From novice to tech pro — start learning today.