Solved

Delphi Indy

Posted on 2013-01-20
23
1,181 Views
Last Modified: 2013-03-01
Hi Experts

Attached is my code I am trying to send emails using Indy10 and Delphi 2006
I get this error

EIdSMTPReplyError with message ''

Any Thoughts
IndyEmail.txt
0
Comment
Question by:Kevinfeening
  • 11
  • 9
  • 2
  • +1
23 Comments
 
LVL 19

Expert Comment

by:Thommy
ID: 38800062
An EIdSMTPReplyError exception is an error returned by the SMTP server. Maybe the server needs additional authentication...

Check this earlier EE post for correctly handling the error...
Handle exception during sending of mailing (IdSMTP, INDY)
0
 
LVL 19

Expert Comment

by:Thommy
ID: 38800072
Can you provide the complete error message?

Maybe you have to issue STARTTLS command first...
Delphi Indy IdSMTP sending error
0
 
LVL 8

Expert Comment

by:lomo74
ID: 38800173
also remember to drop the necessary auth mechanisms on the form.
put the TIdSASL* components on the form, then go to IdSMTP component, edit SASLMechanisms property, move all needed auth mechanisms from "available" to "assigned".
0
 

Author Comment

by:Kevinfeening
ID: 38800689
Attached is the error and you have the code
error.png
error.gif
0
 
LVL 1

Expert Comment

by:gxs
ID: 38807309
Well, I have looked into that for hours because I want to know also how to send an email. You know there are various way.

I came up with the following:

http://www.experts-exchange.com/Programming/Languages/Pascal/Delphi/Q_26528266.html

http://www.marcocantu.com/tips/oct06_gmail.html

I hope your problem get solved.
0
 
LVL 1

Expert Comment

by:gxs
ID: 38808341
We won't get out of this till we solve the problem :p ( count me +1 )
0
 

Author Comment

by:Kevinfeening
ID: 38812863
Thanks gxs for the link but the code is beyond me
Another thing is that when I get the error the program still sends the email to micropower staff but wont send to my hotmail account

Is there anything I can send you to help find my problem
0
 
LVL 1

Expert Comment

by:gxs
ID: 38815266
I will work on that tonight and post the solution if god wells.
0
 
LVL 1

Expert Comment

by:gxs
ID: 38817440
Kevin, I was trying to run your code using XE2 and Indy 10 but I noticed that my Indy 10 components are -not- complete(came as default with XE2). I don't know if I have to uninstall the entire component set and install it directly from indy or not. Please advise. << my first time dealing with such an issue.

Regarding your current problem. Your code is basic and looks logical but please pay attention to that you need certain modification to your code based on the SMTP server that you will use.

You might used SMTP.hotmail.com where it is supposed to be smtp.live.com etc. Hotmail uses SSL as an authentication method and gmail uses TLS as I have read through the past.

Please advise me on the Indy issue if you have any background about uninstalling/upgrading so I can get back up and running. ( I'll keep searching also )
0
 

Author Comment

by:Kevinfeening
ID: 38817475
The indy components all came with Delphi 2006
Don't know about uninstall or upgrade

Checking about server, currently Server is the Micropower Server finding out what it connects to
0
 
LVL 1

Expert Comment

by:gxs
ID: 38824110
Sorry for getting back to you late. I have been busy on a little project.

Anyway, I figured out that it would take me a week or two to figure out Indy deeply.

So I found a stable and powerful solution (temporarily).

So here how it works (simple also based on your request):

Go and download the following file (trust me, you will need to download it right awaaay : )

http://www.emailarchitect.net/webapp/download/easendmail.exe

1. Install it on your computer.
2. Open Delphi.
3. Go to "Component" tab, then "Import Component..." Wizard.
4. The wizard will fire up. Select "Import Type Library".
5. Search for "EASendMail". If it doesn't show up then click "Add" and search for "EASendMailObj.dll" in the installation folder of the application you just installed.
6. Select after adding, Click next then "Create Unit" and "Finish".
7. Now create a new project for testing.

Go with the following code:

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, EASendMailObjLib_TLB; // add EASendMail unit Kevin

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  oSmtp : TMail;
begin
  oSmtp := TMail.Create(Application);
  oSmtp.LicenseCode := 'TryIt'; // pay attention to that, will talk about it later Kevin

  // Set your sender email address
  oSmtp.FromAddr := 'test@emailarchitect.net'; // your email

  // Add recipient email address
  oSmtp.AddRecipientEx( 'support@emailarchitect.net', 0);

  // Set email subject
  oSmtp.Subject := 'simple email from Delphi project';

  // Set email body
  oSmtp.BodyText := 'this is a test email sent from Delphi project, do not reply';

  // Your SMTP server address
  oSmtp.ServerAddr := 'smtp.emailarchitect.net'; // "smtp.google.com", "smtp.live.com"

  // User and password for ESMTP authentication, if your server doesn't require
  // user authentication, please remove the following codes
  oSmtp.UserName := 'test@emailarchitect.net'; 
  oSmtp.Password := 'testpassword'; // you need to type your pass : )

  // If your SMTP server requires SSL connection, please add this line
  oSmtp.SSL_init();

  ShowMessage( 'start to send email ...' );

  if oSmtp.SendMail() = 0 then
    ShowMessage( 'email was sent successfully!' )
  else
    ShowMessage( 'failed to send email with the following error: '
    + oSmtp.GetLastErrDescription());

end;

end.

Open in new window


Just add a button only to test it out then modify it as you need.

It works perfectly and flawlessly. Remember the part "pay attention ?"

That's a function for the trial of the component. Don't freak out. The trial period is not restricted to anything. The component is for evaluation purposes only, which means that you can steal it on the fly. But! Please if you profit from it don't forget to pay the guys. They deserve it.

If you get lost please refer back to:

http://www.emailarchitect.net/easendmail/kb/delphi.aspx?cat=4

good luck ; )
0
6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

 

Author Comment

by:Kevinfeening
ID: 38825378
Thanks GXS

Attached is the results of the program

:(

Kevin
Email.docx
0
 
LVL 1

Expert Comment

by:gxs
ID: 38825583
Sorry for being late,

here is the sharpened code [Hotmail]:

procedure TForm1.Button1Click(Sender: TObject);
var
  oSmtp : TMail;
begin
  oSmtp := TMail.Create(Application);
  oSmtp.LicenseCode := 'TryIt';

  oSmtp.FromAddr := 'gxs@hotmail.com';

  oSmtp.AddRecipientEx( 'whatever@gmail.com', 0);

  oSmtp.Subject := 'simple email from Hotmail account';

  oSmtp.BodyText := 'this is a test email sent from Delphi using Hotmail';

  oSmtp.ServerAddr := 'smtp.live.com';

  oSmtp.ServerPort := 587; // Specify the Hotmail's port
  oSmtp.SSL_init();

  oSmtp.UserName := 'gxs@hotmail.com';
  oSmtp.Password := '#########';

  ShowMessage( 'start to send email ...' );

  if oSmtp.SendMail() = 0 then
    ShowMessage( 'email was sent successfully!' )
  else
    ShowMessage( 'failed to send email with the following error: '
    + oSmtp.GetLastErrDescription());

end;

Open in new window

0
 

Author Comment

by:Kevinfeening
ID: 38826249
Sorry I am not using hotmail to send that was one of my email accounts I was trying to send to as a test. I have asked the techs to tell me the supplier our email server connects to it isn't a standard email server like hotmail gmail etc.
Hopefully this makes sence
0
 
LVL 1

Expert Comment

by:gxs
ID: 38829364
Kevin, I see where you going with this. You need to provide more details about your server. The subject is going off road a little bit but I don't mind. I'll help you.

You need to focus on these things:

1. What is the OS of the server ?
2. Is there a control panel on it ? (Plesk, cPanel)
3. What is the Mail Server ?
4. What are the configurations of the Mail Server (outbound/inbound ports etc.) ?
5. Will you use multiple Servers/Mail Servers ?

Whether you provide me with the details or tell the technicians to focus on them and edit the code, it's up to you.

Appreciated.
0
 

Author Comment

by:Kevinfeening
ID: 38829375
Passed on to the expert

5.. There will be multiple servers as I am using this in conjunction with a payroll system

also in answer to an earlier question its part of a product and no extra charge is added for the email option

Will get back to you with the 1 - 4 answers

Kevin
0
 

Author Comment

by:Kevinfeening
ID: 38829398
FYI

I previously was using NMSMTP1 - TNMSMTP and delphi 5 for the email and it worked fine for clubs but the new sites required userid and password but there wasn't a password option in the NMSMTP1 so that why the change

Kevin
0
 
LVL 1

Accepted Solution

by:
gxs earned 500 total points
ID: 38829660
Well, you can do that if you are running on a private server (no pass required).

But can you imagine how hard it is for me to know what is going on in your side ?

Like, the server is not infront of me.

So, I hope you get back with the answers.
0
 

Author Comment

by:Kevinfeening
ID: 38829755
This is the Tech's reply

Thanks
config.docx
0
 
LVL 1

Expert Comment

by:gxs
ID: 38829881
Can you provide me with the old code ?

If you want to keep it private. Send it to gxs@hotmail.com
0
 
LVL 1

Expert Comment

by:gxs
ID: 38829888
Just a quick question. Did this problem appeared because you upgraded the Exchange server or anything else?

or you just want to upgrade the code to newer versions of Delphi ?
0
 

Author Comment

by:Kevinfeening
ID: 38829905
Upgraded to newer version due to the old version of SMTP didn't have a password option
Still using old version on current server. Other clubs are havine problems with the old version as engineers want to use Authorization

Attached is the old code using delphi 5
oldcode.txt
0
 
LVL 1

Expert Comment

by:gxs
ID: 38830168
This getting wider than what I expected. If you wish, add me on skype. I will post the solution here when we get done.

send me your user name to gxs@hotmail.com

If you wish to reject the offer. It is up to you.

I will contact you tomorrow because it is after midnight here.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

16 Experts available now in Live!

Get 1:1 Help Now