Advertisement

10.30.2006 at 08:52AM PST, ID: 22042523
[x]
Attachment Details

Using IdSMTPServer ?

Asked by Balshe in Delphi Programming

Tags: idsmtpserver, delphi

Hi,

My question is : how can i use IdSMTPServer to send e-mails from my PC? or is there is a way to send bulk e-mails without using My ISP, Hotmail, Yahoo, or google accounts? and if i must use one of those then how can i do it?

knowing i have Delphi 2006, INDY 10 components.

also please note that i don't want to buy any component, if there is a free components Plus Examples on how to use them in the way that I've just mentioned, then it's also a good idea, but i prefer if it's INDY 10 and IdSMTPServer.

thanks in advance,
Start Free Trial
[+][-]10.30.2006 at 02:28PM PST, ID: 17837997

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Delphi Programming
Tags: idsmtpserver, delphi
Sign Up Now!
Solution Provided By: AndersonCarli
Participating Experts: 5
Solution Grade: A
 
 
[+][-]10.30.2006 at 02:53PM PST, ID: 17838165

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 12:39AM PST, ID: 17840488

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 04:52AM PST, ID: 17841477

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 08:06AM PST, ID: 17842978

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 10:26AM PST, ID: 17844195

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 10:46AM PST, ID: 17844343

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]10.31.2006 at 01:32PM PST, ID: 17845664

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.31.2006 at 01:54PM PST, ID: 17845811

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]10.31.2006 at 05:31PM PST, ID: 17847080

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.01.2006 at 12:48AM PST, ID: 17848235

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.01.2006 at 01:32PM PST, ID: 17853310

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.02.2006 at 02:05AM PST, ID: 17856766

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2006 at 03:29AM PST, ID: 17857126

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2006 at 05:57AM PST, ID: 17857950

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.02.2006 at 07:19AM PST, ID: 17858592

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2006 at 04:25PM PST, ID: 17863241

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.03.2006 at 12:27AM PST, ID: 17864853

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]11.03.2006 at 06:57AM PST, ID: 17866807

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.03.2006 at 07:03AM PST, ID: 17866862

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.03.2006 at 08:17AM PST, ID: 17867577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.03.2006 at 08:34AM PST, ID: 17867776

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.03.2006 at 09:09AM PST, ID: 17868110

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.06.2006 at 04:07AM PST, ID: 17880300

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.06.2006 at 04:59AM PST, ID: 17880570

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.06.2006 at 05:01AM PST, ID: 17880587

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.06.2006 at 07:08AM PST, ID: 17881383

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.08.2006 at 07:55AM PST, ID: 17899003

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.09.2006 at 02:59AM PST, ID: 17905285

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.20.2006 at 01:29AM PST, ID: 17977864

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.10.2008 at 02:40PM PDT, ID: 21090716

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
10.30.2006 at 02:28PM PST, ID: 17837997
Look at Indy demos in:
  http://www.indyproject.org/Sockets/Demos/index.en.aspx

It will show how to send emails trough SMTP, without using any ISP.

But note that most email servers does'nt accept email from dialup (cable, DSL) connections,
so if you have static IP and you start to send spam, your IP will be black-listed.

Cheers,

Anderson
Accepted Solution
 
10.30.2006 at 02:53PM PST, ID: 17838165
i've already tryied those, but it didn't work
when i use "Indy 10 SMTPServer" demo i get this error"socket error # 10048 address already in use" and i didn't know how to fix it

do you have another example?


regards,
 
10.31.2006 at 12:39AM PST, ID: 17840488
You said: is there is a way to send bulk e-mails without using My ISP, Hotmail, Yahoo, or google accounts

is there is a way to send bulk e-mails without using My ISP, Hotmail, Yahoo, or google accounts?

Anyone who is asking "is there is a way to send bulk e-mails without using My ISP, Hotmail, Yahoo, or google accounts" is trying to build a spambot, if you ask me. :-(
 
10.31.2006 at 04:52AM PST, ID: 17841477
I have to agree to Alex' thought.

So maybe Balshe will give some more information about what he wants to.

The Answer to you #10048 is simple, but I won't help anyone building a spambot.
 
10.31.2006 at 08:06AM PST, ID: 17842978
guys you got me wrong :)

i want to create a monitoring tool for my PC at home and at work but i don't want anyone to know about it, and i don't want it to use any if my accounts or the company account because it's monitored. also it's some times needed to test our new outlook exchange projects in the company and I've been asked many times to build a program to send bulk e-mails to a specific account in the company or to multiple accounts to see how the anti spam procedure and program is working.
beside i've done it before in VB, but i don't know how to do it in Delphi.
so any suggestions?


Regards,
 
10.31.2006 at 10:26AM PST, ID: 17844195
I found this on INDY Docs.

//--
For TIdLPR and TIdRSH, we force the client to bind to a local port within a specific range before connecting to a server because these protocols require the client to use specific local port ranges when making a connection to a server.  This is done with the TIdTCPClient.BoundPortMin and TIdTCPClient.BoundPortMax properties.

 

Usually, if you do this with a specific IP address while a local port is in FD_WAIT state, the bind fails and Indy will then try to bind to the next port.  Unfortunately, when using the wildcard IP address (0.0.0.0), the bind will succeed while a port is in a FD_WAIT state but when you connect, you get an "Address already in use" error.  

 

The only workarounds available are:

 

• Wait a minute for the local port to get out of FD_WAIT state.

• Set the TIdTCPClient.BoundIP property to the to the machine's current local IP address.  This workaround can be problematic if a machine has more than one local IP address and you do not know which one to use.

 

For most clients, the best practice is to let the stack select any available local port because most servers do not care what local port the client is using and because of the issue we mentioned earlier.  Do not use the TIdTCPClient.BoundPort, TIdTCPClient.BoundPortMax, and TIdTCPClient.BoundPortMax properties unless you have a very compelling reason to do so.



//----

so now i put  TIdTCPClient.BoundIP =my local ip address
and i put the IDSMTP.BINDING to (0.0.0.0:158) PCMail-srv.

now i think it will work, i'll keep u updated guys

regards,

 
10.31.2006 at 10:46AM PST, ID: 17844343
ok Guys,

i reached a point where the SmtServer receives the message, but how can i make the smtp server sends the message to required e-mail address ???


regards,
 
10.31.2006 at 01:32PM PST, ID: 17845664
by far the easiest method is to simply have your SMTP server forward via your own ISP's mail server.
e.g. if your ISP is "meganet" smtp.maganet.com then you would forward all mail to smtp.maganet.com using the basic TidSMTPClient

You can of course, do the DNS lookup and SMTP relay yourself ( i think there might eb an example of SMTPRElay in the demos dir) but the above method is the easiest, and will
  use less international traffic (if you are concerned about such things)
  be more reliable (if your isp is down, you are unlikely to be on..)
  be faster (presuably you choose an ISP in your neighbourhood)
Totally up to you though :-)
Assisted Solution
 
10.31.2006 at 01:54PM PST, ID: 17845811
Yep - Loki is right - the easiest ways is something like this:

first - take the reveived Message (in SMTPServerReceiveMessageParsed event - hmm - I'm using indy9 - not sure if they changed this a little bit in v10) - in this event you have the ability to modify the content or headers of the mail
procedure TForm1.SMTPServerReceiveMessageParsed(ASender: TIdCommand;
  var AMsg: TIdMessage; RCPT: TIdEMailAddressList;
  var CustomError: string);

after you did what ever you want with your message(checking, adding CCs, BCCs,etc) push it out with an instance of TIdSMTP, like this:

      SMTP := TIdSMTP.Create(nil);
      SMTP.AuthenticationType := atNone;
      SMTP.Intercept := IdLogFile; //just for debugging if you like to
      SMTP.MaxLineAction := maException;
      SMTP.UseEhlo := true;
      SMTP.Host := edSMTPHost.Text; //your isp
      SMTP.Port := 25;
      SMTP.Connect();
      SMTP.Send(AMsg);
      if(SMTP.Connected) then SMTP.Disconnect;
      SMTP.Free;

This will send the received AMsg to the 'real' receiver

Sure you can use the relay, but except things like DNS lookup you have to think about other mechs that e.g. a sendmail server would - spooling, retries, bouncing etc. To get a delphi program behave like a common smtp relay is much work. Many rfcs you should read ;) It depends on what you expect from your application. Receiving, doing some work with the messages and sending it out after this, should be done by the above way very easy. And you don't have to think about all the common smtp server problems as mentioned.

gracias
icecoke


Assisted Solution
 
10.31.2006 at 05:31PM PST, ID: 17847080
Though i said i  said i don't want to send the email  using my ISP account Nor Gmail, but it's possible to use Gmail account, but the problem with Gmail is that i get an error message "Exception class EIdTLSClientSSLIOHandlerRequred with message 'SSL IOHandler is required for this setting"

Here is the code:




procedure TForm1.IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext;
  AMsg: TStream; var LAction: TIdDataReply);
var
 LMsg : TIdMessage;
 LStream : TFileStream;
 SMTP :TIdSMTP;
 MailHStack : TIdIOHandlerStack ;
begin

      LStream := TFileStream.Create(ExtractFilePath(Application.exename) + 'test.eml', fmCreate);
      MailHStack := TIdIOHandlerStack.Create(nil);
      SMTP := TIdSMTP.Create(nil);
      SMTP.AuthType := atSASL;
      SMTP.IOHandler := MailHStack;
      SMTP.UseTLS :=utUseImplicitTLS   ;
      SMTP.UseEhlo := True;
      SMTP.Host := 'smtp.gmail.com';
      SMTP.Port := 587;
      SMTP.Username:='MYGMAILACC@gmail.com';
      SMTP.Password:='MYPASS';
      LMsg:=TIdMessage.Create(nil);
      LMsg.LoadFromStream(LStream);
      SMTP.Connect();
      SMTP.Send(LMsg);
      if(SMTP.Connected) then SMTP.Disconnect;
      SMTP.Free;
Try
 LStream.CopyFrom(AMsg, 0);
Finally
 FreeAndNil(LStream);
End;

LMsg := TIdMessage.Create;
Try
 LMsg.LoadFromFile(ExtractFilePath(Application.exename) + 'test.eml', False);
 ToLabel.Caption := LMsg.Recipients.EMailAddresses;
 FromLabel.Caption := LMsg.From.Text;
 SubjectLabel.Caption := LMsg.Subject;
 Memo1.Lines := LMsg.Body;
Finally
 FreeAndNil(LMsg);
End;

end;



all this is because Gmail Needs to receive STARTTLS command first
since i got this error:"Must issue a STARTTLS command first"
and if you go to this link:
http://www.indyproject.org/KB/index.html?smtpmuststarttls.htm
you will find the solution:
"Indy 10 supports SMTP with explicit TLS.  In the Indy 10's TIdSMTP, you simply have to assign a TIdSSLIOHandlerSocketBase descendent to the TIdSMTP.IOHandler property and set the UseTLS property to either utUseRequireTLS if you do not want to use an unencrypted connection or utUseExplicitTLS if you are willing to use an unencrypted connection."

but i didn't know how to do it
can you help me here?
 
11.01.2006 at 12:48AM PST, ID: 17848235
Balshe,

because I still use Indy9, my knowledge regarding the Indy10 SSL components is limited. I use the 'Clever Internet Suite' for doing ssmtp, which is quite nice and stable (no, I'm not connected to this company ;)).

But as far as I understand you just need to do this:

SMTP.IOHandler := <your TIdSSLIOHandlerSocketBase descendent>;
SMTP.UseTLS :=utUseExplicitTLS; //or utUseRequireTLS

But maybe one of the other peoples here has an exact information on this.

gracias
icecoke
 
11.01.2006 at 01:32PM PST, ID: 17853310

thanks "real_icecoke" for your answer,

but i need to know how to use "IOHandler " along with "TIdSSLIOHandlerSocketBase descendent"

"Workshop_Alex" what do you think ? :)

Regards,
 
11.02.2006 at 02:05AM PST, ID: 17856766
hmm - thought this could be done by a simple:

mySIOH := TIdSSLIOHandlerSocketBase.Create;
SMTP.IOHandler := mySIOH;

but as I said - I have no indy 10.

So, listening.......



icecoke
 
11.02.2006 at 03:29AM PST, ID: 17857126
> "Workshop_Alex" what do you think ? :)

I still think your intentions are a bit suspicious. You want to create a bulk emailer which bypasses your ISP at home and at work, making sure no one can link it back to you. If it's just for a simple monitoring tool then I just wonder why you're not using other techniques for this purpose. If all you want to do is monitor some system then it seems to me that a technique like SOAP would be far less suspicious.

The problem with GMail is the SSL for which the Indy components require some additional DLL. This DLL isn't freely available all over this world, even if it's a free tool. The techniques it contains cannot be exported to certain countries due to the laws on encryption in the USA. But I think that a Google search might turn up some sample code for Delphi/Indy that will allow you to send emails through the Google servers. At home I even have some code that allows me to send emails through SMTP over Google but right now (and for the next 8 hours) I'm not at home. Is that what you're looking for?
 
11.02.2006 at 05:57AM PST, ID: 17857950
Guys thanks for your support,

Dear Workshop_Alex,
if i'm going to use Gmail, do u think it's suspicious ?. anyway it's not for bad purpose i assure you. and it would be great if you send me some code that explains how to send through Gmail SMTP servers.
Also i would like for my program to be stand-alone not using additinal DLLS, is it possible ?

thanks again guys
 
11.02.2006 at 07:19AM PST, ID: 17858592
Nope. Using GMail wouldn't be suspicious in my opinion. GMail is taking actions against spammers and people who abuse their email system. Btw, I am willing to believe you but can't take the risk that you're dishonest in your intentions. We don't need any more spammers. :-)

You still have to wait about 4 more hours before I'm back home, where I have some sample code available for sending emails with GMail. (And also on how to receive them from a GMail POP3 setup.) Unfortunately, I am not aware of any solution without the use of this special SSL DLL.
 
11.02.2006 at 04:25PM PST, ID: 17863241


i reached a point where i need a dll file "ssleay32.dll"
and i found it but it seems to be the wrong version, and i don't know if i need this dll "libeay32.dll" or not

and now i'm getting error "can not load SSL Library"


and here is the code




procedure TForm1.IdSMTPServer1MsgReceive(ASender: TIdSMTPServerContext;
  AMsg: TStream; var LAction: TIdDataReply);
var
 LMsg : TIdMessage;
 LStream : TFileStream;
 SMTP :TIdSMTP;
 SSL_LIST:TIdSASLEntries ;
 SSLHandler: TIdSSLIOHandlerSocketOpenSSL;
begin

      LStream := TFileStream.Create(ExtractFilePath(Application.exename) + 'test.eml', fmCreate);

      SSL_LIST:=TIdSASLEntries.Create(nil);
      SSLHandler:=TIdSSLIOHandlerSocketOpenSSL.Create;
      SSLHandler.Destination := 'SMTP.gmail.com:465';
      SSLHandler.Host := 'SMTP.gmail.com';
      SSLHandler.Port := 465;
      SSLHandler.DefaultPort := 0;
      SSLHandler.SSLOptions.Method := sslvTLSv1;
      SSLHandler.SSLOptions.Mode := sslmUnassigned;
      SSLHandler.SSLOptions.VerifyMode := [];
      SSLHandler.SSLOptions.VerifyDepth := 0;
      SMTP := TIdSMTP.Create(nil);
      SMTP.IOHandler := SSLHandler ;
      SMTP.UseTLS :=utUseImplicitTLS   ;
      SMTP.UseEhlo := True;
      SMTP.Host := 'smtp.gmail.com';
      SMTP.Port := 465;
      SMTP.Username:='MyGmailAcc@gmail.com';
      SMTP.Password:='MyPass';
      LMsg:=TIdMessage.Create(nil);
      LMsg.LoadFromStream(LStream);
      SMTP.Authenticate;
      SMTP.Connect();
      SMTP.Send(LMsg);
      if(SMTP.Connected) then SMTP.Disconnect;
      SMTP.Free;


Try
 LStream.CopyFrom(AMsg, 0);
Finally
 FreeAndNil(LStream);
End;

LMsg := TIdMessage.Create;
Try
 LMsg.LoadFromFile(ExtractFilePath(Application.exename) + 'test.eml', False);
 ToLabel.Caption := LMsg.Recipients.EMailAddresses;
 FromLabel.Caption := LMsg.From.Text;
 SubjectLabel.Caption := LMsg.Subject;
 Memo1.Lines := LMsg.Body;
Finally
 FreeAndNil(LMsg);
End;

end;

 
11.03.2006 at 12:27AM PST, ID: 17864853
Unfortunately, haven't had the chance to get the code, but you are correct about those library files. But I have a code example for you:

idSMTP := TIdSMTP.Create( Self );
try
  idSMTP.OnStatus := idSMTPStatus;
  idSMTP.OnDisconnected := idSMTPDisconnected;
  idSMTP.OnWork := idSMTPWork;
  idSMTP.OnWorkBegin := idSMTPWorkBegin;
  idSMTP.OnWorkEnd := idSMTPWorkEnd;
  idSMTP.MailAgent := 'Your application';
  idSMTP.OnFailedRecipient := idSMTPFailedRecipient;
  idSMTP.OnTLSNotAvailable := idSMTPTLSNotAvailable;
  IdSMTP.Host := Configuration.SMTP.Text;
  IdSMTP.Port := StrToInt( Configuration.SMTP.Port );
  IdSMTP.Username := Configuration.Sender.Account.Text;
  IdSMTP.Password := Configuration.Sender.Account.Password;
  IdSMTP.AuthType := atDefault;
  IdSSLIOHandlerSocketOpenSSL := TIdSSLIOHandlerSocketOpenSSL.Create( Self );
  IdSSLIOHandlerSocketOpenSSL.DefaultPort := 0;
  IdSSLIOHandlerSocketOpenSSL.MaxLineAction := maException;
  IdSSLIOHandlerSocketOpenSSL.OnGetPassword := IdSSLIOHandlerSocketOpenSSLGetPassword;
  IdSSLIOHandlerSocketOpenSSL.OnStatus := IdSSLIOHandlerSocketOpenSSLStatus;
  IdSSLIOHandlerSocketOpenSSL.OnStatusInfo := IdSSLIOHandlerSocketOpenSSLStatusInfo;
  IdSSLIOHandlerSocketOpenSSL.SSLOptions.Mode := sslmClient;
  IdSSLIOHandlerSocketOpenSSL.SSLOptions.VerifyDepth := 2;
  IdSSLIOHandlerSocketOpenSSL.SSLOptions.VerifyMode := [ ];
  IdSSLIOHandlerSocketOpenSSL.Host := IdSMTP.Host;
  IdSSLIOHandlerSocketOpenSSL.Port := IdSMTP.Port;
  IdSSLIOHandlerSocketOpenSSL.SSLOptions.Method := sslvSSLv3;
  IdSSLIOHandlerSocketOpenSSL.PassThrough := True;
  IdSMTP.IOHandler := IdSSLIOHandlerSocketOpenSSL;
  IdSMTP.UseTLS := utUseImplicitTLS;
  IdSMTP.Connect;
  try
    IdSMTP.Send( Message );
  finally IdSMTP.Disconnect;
  end;
finally IdSMTP.Free;
end;

The Configuration object used in above example is where I store the settings of my account so replace it with the values you need. I also set MailAgent to some value so I can recognise messages from my own mailreader when I'm receiving them again through my POP3 reader. :-)
All the other settings have been copied by me from an old example that I used to have, but I replaced the sample with above code in my archive.
You might want to put the Connect() and Send() commands in a repeating loop, trying to connect/send up to three times since I discovered that GMail doesn't always execute the commands correctly. (It's a busy server.) By trying to reconnect and send a few times, you get around possible issues. For this repeating, I use the following code:

// To connect. (Repeats is an integer type.
Repeats := 3;
while ( Repeats > 0 ) do begin
&nbs