Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Indy Quicksend

Status
Not open for further replies.

sggaunt

Programmer
Jul 4, 2001
8,620
GB
I am attemting to migrate to indy, to send simple SMTP email (for application registration) I tried the mail demo and this seems to work (it dosent crash) but I diddnt recive the test mail!
But the demo uses the SMTP.Send method there is also a SMPT.Quicksend() which should do what I need, but I get 'socket error 1104' oddly before it even attempts to dial up.


Steve: Delphi a feersum engin indeed.
 

This works for me:
Code:
[COLOR=red]{ Quick and dirty SendEmail routine. }[/color]
procedure TfrmMain.SendEMail(ASendTo, ASubject, AText: string);
begin
  IdSMTP1.QuickSend('smtp.mycompany.com', ASubject, ASendTo, 'ProgramXYZ', AText);
end;
Invoked like this:
Code:
SendEMail('SystemOperator@mycompany.com', 'Program XYZ Error Report', AMessage );
I just drop a TIdSMTP component (from the Indy Clients tab) on the form and voila.

As for the socket error, I don't know.



 
Zathras. I used your code (my first attempt was in effect the same anyway) and got the same error.
I also downloaded the email demo app from the indy site, and that does the same thing.
It does work 'here' however where I am on a network attached through a NAT server to an always on connection.
I wonder if the problem is because, a dial up is required.
I was using the ICS component suite to do this under Delphi4. Most of the coding required for this was to implement the dialup using a RAS module.




Steve: Delphi a feersum engin indeed.
 
TIdSMTP code doesn't know about RAS connection.

does it work if you do a manual dialup and then use the Quicksend??

-----------------------------------------------------
What You See Is What You Get
Never underestimate tha powah of tha google!
 
Digging around I found I had a RASManager component (I diddnt have it installed), which simplifies the Dial up side of this a lot, and I have got it working well with Quicksend.
I'm experimenting with this setup now, the things I need to tie down are.

How to detect if a Connection that The SMTPQuicksend can use is already established. So I only lauch the dial up (RASManager) if it is required?

How to be certain that the Quicksend had done its job, so the connection (RAS and SMTP) can be terminated?

The RAS Manager is capable of extracting all the Dialup hosts from the local computer.
But The smpt handler needs the smtp server address e.g 'smtp.nsworld.com'.
I can extract the 'default' email target from HKCU/ software/microsoft/internet account manager/accounts/00000001

But the other accounts are in 'identity' locations which I belive may change from machine to machine.
Is there any way to get at the SMTP information for all accounts.






Steve: Delphi a feersum engin indeed.
 
How to detect if a Connection that The SMTPQuicksend can use is already established. So I only lauch the dial up (RASManager) if it is required?

Use RasEnumConnections and RasGetConnectStatus.


How to be certain that the Quicksend had done its job, so the connection (RAS and SMTP) can be terminated?

No idea. But: a) the TIdSMTP is synchronous (it returns only after the mail is sent) of b) it is asynchronous and produces some event to signal the operation end.

Check the Indy manuals (BTW: the most horrible manuals in all the known universe).


[...] The smpt handler needs the smtp server address e.g 'smtp.nsworld.com'.
I can extract the 'default' email target from HKCU/ software/microsoft/internet account manager/accounts/00000001

But the other accounts are in 'identity' locations which I belive may change from machine to machine.
Is there any way to get at the SMTP information for all accounts.

Ask the user at configuration or operation time. You can't solve it on your own.

(Ask at configuration time, set a command to change the data at any time, ask for server confirmation at sending time, things like that).

buho (A).

 
Cheers buho
1. The RAS Manager component would seem to provide functions that call those API's, I will look at that.

2. Cheers will do that, I have already been looking at the Indy manuals, so I know what you mean!

3. The last point is how I have been doing this with the previous version, i.e the application attempts to get the smtp server name and if it fails I display boxes for them to enter it manually. So I will develop this system further to cover the changes.
The application is designed primarily for home use.


Steve: Delphi a feersum engin indeed.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top