• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 182
  • Last Modified:

automatically sending mail through Delphi

I'm using Delphi 3 and I was wondering if there is a way to automatically send an email through my program

My program creates a file, and I would like it to be emailed automatically once created...is there a way to do this...ie automatically send the email to a specified address

If so, how?
If someone is willing to help me with this all the way throught (code etc...) I would be willing to up the points too...

thanks in advance
0
rafy
Asked:
rafy
  • 3
  • 2
  • 2
  • +7
1 Solution
 
viktornetCommented:
Hello Rafy!

There isn't a way to do that with a function, but you should you write your own code by using components and such... try the DSP (Delphi Super Site) and check out the components there...

YOu can open the e-mail browser though...here is how...

ShellExecute(0, 'open', 'mailto:viktor@megsinet.net', 'TheSubject', nil, SW_NORMAL);

Don't forget to include the ShellAPI to your uses clause...

-Viktor
--Ivanov
0
 
scrapdogCommented:
There is an excellent set of components at http://www.rtfm.be/fpiette/
0
 
rwilson032697Commented:
Or you could use the TSMTP component

Raymond.

0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

 
StevenBCommented:
 Download the Internet Mail Suite from

  http://www.argosoft.com/

  these are the easiest/best mailing components I've found. If you decide to use them then I'll be happy to help you with any problems.

  Steven
0
 
intheCommented:
here is procedure i use
just place a button,2 edits and a memo on form to test:

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',PCharBuffer),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
almost all mail progs have s for send mail and i have used this on many pc's without fault.
Regards Barry
0
 
intheCommented:
whoops missed a  bracket
 
ShellExecute                    
(Application.Handle,'open',PChar ( Buffer),nil,nil,SW_Normal);

Regards Barry
   
0
 
jcondeCommented:
rafy, scrapdog gave you the url for a really good set of freeware-source included components.  In ICS there are plenty of examples including a smtp demo program.

I suggest you download ICS from the url scrapdog stated, and check the code.....it's quite simple.

Regards,

Jorge
0
 
scrapdogCommented:
It was so easy to learn, I was up and running in 10 minutes.  I am definitely going to send the guy a postcard.
0
 
skatan187Commented:
like scrapdog said,
http://www.rtfm.be/fpiette/ .. ICS (internet component suite..)

chECk oUt the smtp component.. Use a mail-server (mail.internetprovider.countrycode as server)

sk
0
 
ptiemann2Commented:
Hi Rafy,
if you try this mailto: stuff with ShellExecute..
be aware of that it depends on the registry and (typically) the email client software whether it every will be sent.
MS-IE installs Outlook Express to handle mailto: but Netscape does not (but an entry in the registry can do it for you).
However, you still depend on the correct installation/ configuration of the mail client. Better use MAPI or a native SMTP component.
0
 
rafyAuthor Commented:
Ok...sorry for the delay but I've been really busy...

I can't say the shellexec is the best solution for this sorry...

I'll have to go with scrapdog's and jconde suggestions

I downloaded the ICS suite, and I think it will do the job, but I'll give the points after I finish the program...if it works and I don't need any more help...great..150 points are all yours...If I need more help before it works...I'll award more points (I figure keeping the question open is the easiest way to keep in touch will all the experts!)

Hope this doesn't bug anyone...

0
 
frla0000Commented:
Hi,

If you want to send a RTF file (formatted text) using MAPI (Exchange, Outlook et c) I can provide you with a finished solution.
I have a DLL and a wrapper for this. Just call a function and you are away. Pretty simple. It took me a lot of research and development to complete it so I can't give you the source to the DLL but the DLL and pascal file you can get.

Otherwise I would suggest you to use TEmail available on http://www.econos.de that also uses MAPI.

Mail me on fredrik.larsson@larsson.tc if you want the DLL.

Regards, Fredrik Larsson.
0
 
rafyAuthor Commented:
works great!
waiting for scrapdog to lock the question so I can give him his points.


rafy
0
 
scrapdogCommented:
Thanks.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

  • 3
  • 2
  • 2
  • +7
Tackle projects and never again get stuck behind a technical roadblock.
Join Now