?
Solved

automatically sending mail through Delphi

Posted on 1999-01-03
14
Medium Priority
?
173 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 600 total points
ID: 1354370
Thanks.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

771 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