Plainer
-
Content Count
27 -
Joined
-
Last visited
Posts posted by Plainer
-
-
Thank you for advise, I will try the demo you mentioned.
Will
-
I did not know that, so with that said, let me ask is it possible to send formatted text using the ICS Smpt component with HTML?
What component would you recommend?
-
Hello, using one of the ICS SMPT mail components is it possible to send rich text in the body of the email?
If it is possible can someone recommend the correct component to use.
Thanks
Will
-
7 hours ago, FPiette said:That was good in your previous run but you called "Mail" instead of "MailFrom".
Ok, I see that I will make a change and give it a go. Thanks.
-
14 hours ago, FPiette said:You should start the next mail at MailFrom stage.
Not to clear on what you meant, however I did make a change by moving the next record call within the case statement. It seemed to make matters worse as it no longer sends out an email but still stops after two records.
smtpMailFrom: begin
SendNextRecord;
SslSmtpClient.RcptTo;
end;The solution is simply eluding me, the concept seems simple but proving difficult to do.
Can you provide an example on the correct insertion point for the next record call?
Thanks
-
17 minutes ago, FPiette said:Are you sure you test all possible error everywhere and don't ignore any exception?
The code you gave yesterday is flawed. Your addition in RequestDone handler to start a new mail do not depend on the RqType but is always executed.
I think you are right, The two emails that do send return the following after sending a email.
First email: RequestDone Rq=5 Error=0
Second email: RequestDone Rq=9 Error=0
I put in a 2 second delay between sends (procedure TEMail_Send.SendNextRecord;) but no real progress, It is on the third email that the system hangs up.
This is the code I am currently working with.
procedure TEMail_Send.BitBtn4Click(Sender: TObject);
begin
DataBase_Mail.GoTop; // not sure about thisif SslSmtpClient.Connected then begin
MessageBeep(MB_OK);
Display('All-In-One demo start in connected state.');
Display('Please quit or abort the connection first.');
Exit;
end;FAllInOneFlag := TRUE;
FEhloCount := 0;
{ Initialize all SMTP component properties from our GUI }
SslSmtpClient.Host := wDataBase_Cfg.GetTrimString('CHOST');
SslSmtpClient.Port := wDataBase_Cfg.GetTrimString('CPORTHOST');
SslSmtpClient.SignOn := wDataBase_Cfg.GetTrimString('CSIGNON');
SslSmtpClient.FromName := wDataBase_Cfg.GetTrimString('CFROM');;
SslSmtpClient.HdrFrom := wDataBase_Cfg.GetTrimString('CFROM');
SslSmtpClient.HdrTo := DataBase_Mail.GetTrimString('COWN1EMAIL');
SslSmtpClient.HdrCc := DataBase_Mail.GetTrimString('COWN2EMAIL');
SslSmtpClient.HdrSubject := DataBase_EMailText.GetString('CSUBLINE');
SslSmtpClient.EmailFiles := nil; // FileAttachMemo.Lines;
SslSmtpClient.AuthType := TSmtpAuthType(wDataBase_Cfg.GetInteger('NAUTHTYPE'));
SslSmtpClient.SslType := TSmtpSslType(wDataBase_Cfg.GetInteger('NSSLType'));if SslSmtpClient.SslType <> smtpTlsNone then begin
SslContext1.SslPrivKeyFile := ''; //KeyEdit.Text;
SslContext1.SslPassPhrase := ''; //PassPhraseEdit.Text;
SslContext1.SslCertFile := ''; //CertEdit.Text;
SslContext1.SslCAFile := ''; //CAFileEdit.Text;
SslContext1.SslCAPath := ''; //CAPathEdit.Text;
//SslContext1.SslVerifyPeer := false; //VerifyPeerCheckBox.Checked;
SslContext1.SslVerifyPeer := wDataBase_Cfg.GetLogical('LSSLVERPER');
if SslContext1.SslVerifyPeer then begin
SslSmtpClient.OnSslVerifyPeer := SslSmtpClientSslVerifyPeer;
SslSmtpClient.OnSslHandshakeDone := SslSmtpClientSslHandshakeDone;
end
else begin
SslSmtpClient.OnSslVerifyPeer := nil;
SslSmtpClient.OnSslHandshakeDone := nil;
end;
end;SslSmtpClient.Username := wDataBase_Cfg.GetTrimString('CUSERNAME');
SslSmtpClient.Password := wDataBase_Cfg.GetTrimString('CPASSWORD');
SslSmtpClient.HdrPriority := TSmtpPriority(wDataBase_Cfg.GetInteger('NPriority'));
{ Recipient list is computed from To, Cc and Bcc fields }
SslSmtpClient.RcptName.Clear;
//SslSmtpClient.RcptNameAdd(ToEdit.Text, CcEdit.Text, BccEdit.text);
SslSmtpClient.RcptNameAdd(DataBase_Mail.GetTrimString('COWN1EMAIL'), DataBase_Mail.GetTrimString('COWN2EMAIL'), '');Display('Connecting to SMTP server...');
{ Start first operation to do to send an email }
{ Next operations are started from OnRequestDone event }//BuildRcptList;
//SendNextEmail;
SslSmtpClient.Connect;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}procedure TEMail_Send.SslSmtpClientRequestDone(Sender: TObject;
RqType: TSmtpRequest; ErrorCode: Word);
begin
{ For every operation, we display the status }
if (Error > 0) and (Error < 10000) then
Display('RequestDone Rq=' + IntToStr(Ord(RqType)) +
' Error='+ SslSmtpClient.ErrorMessage)
else
Display('RequestDone Rq=' + IntToStr(Ord(RqType)) +
' Error='+ IntToStr(Error));
{ Check if the user has asked for "All-In-One" demo }
if not FAllInOneFlag then
Exit; { No, nothing more to do here }
{ We are in "All-In-One" demo, start next operation }
{ But first check if previous one was OK }
if Error <> 0 then begin
FAllInOneFlag := FALSE; { Terminate All-In-One demo }
Display('Error, stoped All-In-One demo');
Exit;
end;
case RqType of
smtpConnect: begin
if SslSmtpClient.AuthType = smtpAuthNone then
SslSmtpClient.Helo
else
SslSmtpClient.Ehlo;
end;
smtpHelo: SslSmtpClient.MailFrom;
smtpEhlo: if SslSmtpClient.SslType = smtpTlsExplicit then begin
Inc(FEhloCount);
if FEhloCount = 1 then
SslSmtpClient.StartTls
else if FEhloCount > 1 then
SslSmtpClient.Auth;
end
else
SslSmtpClient.Auth;smtpStartTls: SslSmtpClient.Ehlo; // We need to re-issue the Ehlo command
smtpAuth: SslSmtpClient.MailFrom;
smtpMailFrom: SslSmtpClient.RcptTo;
smtpRcptTo: SslSmtpClient.Data;smtpData: if DataBase_Mail.Eof then
begin
SslSmtpClient.Quit;
Display('Mail Done !');
end
else
begin
if nSentCount = 0 then
begin
nSentCount := (nSentCount+1);
SentCount.Caption := IntToStr(nSentCount);
end;
SendNextRecord;
end;smtpQuit: if DataBase_Mail.Eof then
begin
Display('Mail Done !');
end;
//else
// begin
// SendNextRecord;
// end;end;
{*******************************************************************}
end;{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TEMail_Send.SendNextRecord;
begin
ShowMessage('Start Test');
Delay(2000);
ShowMessage('End Test');DataBase_Mail.Skip(1);
if not DataBase_Mail.Eof then
begin
FAllInOneFlag := True;
SslSmtpClient.RcptName.Clear;
SslSmtpClient.RcptNameAdd(Trim(DataBase_Mail.GetTrimString('COWN1EMAIL')), Trim(DataBase_Mail.GetTrimString('COWN2EMAIL')), '');
SslSmtpClient.HdrFrom := wDataBase_Cfg.GetTrimString('CFROM');
SslSmtpClient.HdrTo := DataBase_Mail.GetTrimString('COWN1EMAIL');
SslSmtpClient.HdrCc := DataBase_Mail.GetTrimString('COWN2EMAIL');
SslSmtpClient.HdrSubject := DataBase_EMailText.GetString('CSUBLINE');
SslSmtpClient.SignOn := wDataBase_Cfg.GetTrimString('CSIGNON');
SslSmtpClient.FromName := wDataBase_Cfg.GetTrimString('CFROM');
SslSmtpClient.EmailFiles := nil; // FileAttachMemo.Lines;
SslSmtpClient.Host := wDataBase_Cfg.GetTrimString('CHOST');
SslSmtpClient.Port := wDataBase_Cfg.GetTrimString('CPORTHOST');
//SslSmtpClient.SendMode := smtpCopyToStream;
SslSmtpClient.Mail;
if nSentCount > 0 then
begin
nSentCount := (nSentCount+1);
SentCount.Caption := IntToStr(nSentCount);
end;
end
else
exit;
end;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *} -
On 8/16/2020 at 1:12 AM, Angus Robertson said:No point in looking at the code since it is using the wrong component, for the third time. You are attempting to recreate code that already exists and works in the TIcsMailQueue component.
Angus
Angus, the example you are talking about is similar but different, your example does send out an email to multiple address but keeps the content of the email static, the program I am working on sends out a unique message to each recipient, by walking though a database,
I have a somewhat working model however one small problem and not sure where it stems from, on the third iteration it hangs, does not give an error simply hangs. I was thinking it maybe a timing issue sending to much to the mail server to quickly. I was thinking that if I put in a small pause between each email it may resolve the issue.
Can I send you a copy of the code for your review and recommendations?
Thank you
Will
-
I have been looking over the sample program and was wondering if I am on the correct path, I was going to give the following a try but wanted some input first.
I was thinking that I can send the next email by using the ClientRequestDone event.
I made my additions in bold text so you can see them.
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
procedure TSslSmtpTestForm.SslSmtpClientRequestDone(
Sender : TObject;
RqType : TSmtpRequest;
Error : Word);
begin
{ For every operation, we display the status }
if (Error > 0) and (Error < 10000) then
Display('RequestDone Rq=' + IntToStr(Ord(RqType)) +
' Error='+ SslSmtpClient.ErrorMessage)
else
Display('RequestDone Rq=' + IntToStr(Ord(RqType)) +
' Error='+ IntToStr(Error));
{ Check if the user has asked for "All-In-One" demo }
if not FAllInOneFlag then
Exit; { No, nothing more to do here }
{ We are in "All-In-One" demo, start next operation }
{ But first check if previous one was OK }
if Error <> 0 then begin
FAllInOneFlag := FALSE; { Terminate All-In-One demo }
Display('Error, stoped All-In-One demo');
Exit;
end;
case RqType of
smtpConnect: begin
if SslSmtpClient.AuthType = smtpAuthNone then
SslSmtpClient.Helo
else
SslSmtpClient.Ehlo;
end;
smtpHelo: SslSmtpClient.MailFrom;
smtpEhlo: if SslSmtpClient.SslType = smtpTlsExplicit then begin
Inc(FEhloCount);
if FEhloCount = 1 then
SslSmtpClient.StartTls
else if FEhloCount > 1 then
SslSmtpClient.Auth;
end
else
SslSmtpClient.Auth;
smtpStartTls: SslSmtpClient.Ehlo; // We need to re-issue the Ehlo command
smtpAuth: SslSmtpClient.MailFrom;
smtpMailFrom: SslSmtpClient.RcptTo;
smtpRcptTo: SslSmtpClient.Data;{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
// Check database for EOF if True then finish
smtpData: SslSmtpClient.Quit;
smtpQuit: Display('All-In-One done !');
exit;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
end;{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
// Send next email
// Get next record reload component and send
SslSmtpClient.RcptName.Clear;
SslSmtpClient.RcptNameAdd(ToEdit.Text, CcEdit.Text, BccEdit.text);
SslSmtpClient.HdrFrom := FromEdit.Text;
SslSmtpClient.HdrTo := ToEdit.Text;
SslSmtpClient.HdrCc := CcEdit.Text;
SslSmtpClient.HdrSubject := SubjectEdit.Text;
SslSmtpClient.SignOn := SignOnEdit.Text;
SslSmtpClient.FromName := FromEdit.Text;
SslSmtpClient.EmailFiles := FileAttachMemo.Lines;
SslSmtpClient.SendMode := smtpCopyToStream;
SslSmtpClient.Mail;
{* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *}
end; -
Thank you, I have gotten past that now a new problem, I just made a new topic.
-
I am trying to create an email program that will send a email to mutable email addresses by reading in a database file and sending out a
email / newsletter to each record in the database. (for my wife's sewing club)
I have been using the "OverbyteIcsSslMailSnd" sample / demo program as an guide.Everything works correctly if I select a record and the send the email. The problem I am having is trying to figure out a way to send the
email to each listed email in the database automatically.
I can not find a direct means to send the batch of emails, I was thinking that if within the "All In One" button I added a while loop to repeat
the process until the database is empty, however that did not work.
So next I tried was to add a test button that calls the "All In One" button using the .click method of the button.
Procedure
Newbutton
Database gotopwhile not database.eof do
begin
allinonebutton.click;
skip database one record;
end;The problem I am having on the second loop "Record 2" I receive a error "SMTP Component not ready".
I am thinking that I may need some sort of a delay timer between iterations.
What am I overlooking?
Thanks
Will -
I have been unable to determine requirements that smtp.aol.com is looking for.
I am using the follwing:
Server Address: smtp.aol.com.
Username: Your AOL Mail screen name (e.g. whatever comes before @aol.com)
Password: Your AOL Mail password.
Port Number: 587 (With TLS)
Alternative Port Number: 465 (With SSL)
Authentication: Required.However I cannot make a connection to send an email. I think that AOL is using a Yahoo backbone but not to sure.
Any ideas on what I am overlooking?
Thanks
-
Just found this in my spam folder.
Delivery has failed to these recipients:
xxxxxxx@aol.com
Subject: Delphi Download Password Request
Remote Server returned: '554 5.7.9 Message not accepted for policy reasons. See https://help.yahoo.com/kb/postmaster/SLN7253.html' -
Ok, this is my confirmation from the server.
Your request has been sent and you should receive a copy delivered to your mailbox within a few minutes.
If the email does not arrive, this is probably because you have entered an incorrect email address, so you should
return to the form and check the address, otherwise you probably won't receive the password email either. -
I did I will try again.
-
It will not run at my end, I keep getting a run-time exception error when it tries to issue the StartTLS command. Let me as you this, I found this "OpenSSL-Win32\openssl.exe" with the ICS install folders, what is it and does it need to be installed?
-
I did that just now (did not see the option at first) The site told me it could take up to 48 hours for a reply, I hope they are quicker then that.
-
I am using a Windows 7 computer.
-
Running on a Windows 7 computer. Tried it on several different computers and same results.
-
Thank you, however the site will not allow me to download the file it seems to be wanting a logon. Anywhere I can download this example?
-
I am trying to learn how to send a SMTP email that uses StartTLS.
I am looking for a working demo program that sends SMTP emails that also can issue a StartTLS command.
I have looked at both the OverbyteIcsSslMailSnd and OverbyteIcsMailQuTst demo programs. The OverbyteIcsSslMailSnd has a runtime execption error when the StartTLS is issued "via button" and "All In One" Button. I have also tried the OverbyteIcsSslMailSnd demo program but receive an error too when it tries to make a secure connection the error I receive is "Failed to Initialise SSL - Must load LIBEAY DLL before SSLEAY"
If anyone can share a working example demo program for sending emails using the ICS suite, it will be very much appreciated.
I am using Delphi7 with the ICS864 component suite.
Thank you
William -
I was able to compile the OverbyteIcsMailQuTst demo program however when I try send a mail I get the following:
Opened log file: f:\eMail Demo 2\ics-mailqu-2020-08-06.log
Failed to Initialise SSL - Must load LIBEAY DLL before SSLEAYI also received the following:
< 530 5.7.0 Must issue a STARTTLS command first. y128sm10201745pfy.74 - gsmtp
Failed to Send Mail Item 5 - 530 5.7.0 Must issue a STARTTLS command first. y128sm10201745pfy.74 - gsmtp
Any help is welcome.
Thanks
-
Any idea why this project is throwing a exception error after attempting to StartTLS? Recompiled with ICS864 and the error persists.
-
Does the inline keyword need to be removed from each *.pas file or is there one location that it can be removed / commented out that will allow D7 to compile ICS864 without errors?
-
Thanks for the information I will give it a go. BTW where will I find TIcsRestEmail component for download when available?
Will
Sending rich text emails?
in ICS - Internet Component Suite
Posted
I had a look at the sample "OverbyteIcsMailHtml", I did not see a way of sending a StartTTLS command, I am sure I must have overlooked it. Is this possible and where should I look?
Thanks