Solved

automatically sending mail through Delphi

Posted on 1999-01-03
14
167 Views
Last Modified: 2010-05-18
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
Comment
Question by:rafy
  • 3
  • 2
  • 2
  • +7
14 Comments
 
LVL 10

Expert Comment

by:viktornet
ID: 1354357
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
 
LVL 5

Expert Comment

by:scrapdog
ID: 1354358
There is an excellent set of components at http://www.rtfm.be/fpiette/
0
 
LVL 12

Expert Comment

by:rwilson032697
ID: 1354359
Or you could use the TSMTP component

Raymond.

0
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 
LVL 4

Expert Comment

by:StevenB
ID: 1354360
 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
 
LVL 17

Expert Comment

by:inthe
ID: 1354361
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
 
LVL 17

Expert Comment

by:inthe
ID: 1354362
whoops missed a  bracket
 
ShellExecute                    
(Application.Handle,'open',PChar ( Buffer),nil,nil,SW_Normal);

Regards Barry
   
0
 
LVL 7

Expert Comment

by:jconde
ID: 1354363
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
 
LVL 5

Expert Comment

by:scrapdog
ID: 1354364
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
 
LVL 1

Expert Comment

by:skatan187
ID: 1354365
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
 

Expert Comment

by:ptiemann2
ID: 1354366
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
 

Author Comment

by:rafy
ID: 1354367
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
 
LVL 1

Expert Comment

by:frla0000
ID: 1354368
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
 

Author Comment

by:rafy
ID: 1354369
works great!
waiting for scrapdog to lock the question so I can give him his points.


rafy
0
 
LVL 5

Accepted Solution

by:
scrapdog earned 150 total points
ID: 1354370
Thanks.
0

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

786 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