Solved

automatically sending mail through Delphi

Posted on 1999-01-03
14
165 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
how to draw animated progressbar in Tvirtualstringtree 5 117
Delphi OLE Error 8 95
Process Javascript errors with Delphi TWebBrowser 1 113
SUM 2 INTEGER ARRAYS INTO 1 10 93
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…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now