<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
Erm...<br>
I understand your code works, but you probably want to remove this
bit. <br>
The RFC doesn't require a pause<br>
<br>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
t := now ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
while (SMTP.Connected) and<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
(now < t + 10 * (1/86400)) do // 10 Seconds<o:p></o:p></span></p>
<span style="color: rgb(31, 73, 125);"> sleep(10) ;<br>
<br>
</span>Also, to get around the mailservers that block you ( e.g.
when they don't know you, or think you're a spam bot)<br>
just relay the message through your own ISP<br>
e.g. if you're with orcon, use mail.orcon.net.nz, if you're with
ihug, use their smtp server...<br>
As long as you have the correct destination email addresses (and
aren't in fact writing a spam bot), the big mail servers can do the
work for you<br>
<br>
David<br>
<br>
On 12/07/2011 2:01 p.m., David O'Brien wrote:
<blockquote
cite="mid:45218D834A0CE743BA57A2A8521AFC2706F0CA@iccs-server.ICCS.local"
type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<meta name="Generator" content="Microsoft Word 14 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
<div class="WordSection1">
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">Wrote
this a while ago, but still works...<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">procedure
SendEmail(msgFrom, msgTo, msgSubject: String; msgBody:
TStringList; Attachments: TStringList) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">var<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
IdMessage: TIdMessage;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP: TIdSMTP;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> t:
TDateTime ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"> i:
Integer ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">begin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
try<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
if ASettings.SMTPServer <> '' then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
begin<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP := TidSMTP.Create(nil) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
IdMessage := TIdMessage.Create(SMTP);<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
try<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
idMessage.Clear ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
idMessage.From.Address := msgFrom ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
idMessage.Recipients.Add.Address := msgTo ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
idMessage.Subject := msgSubject ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
if pos('<html', lowercase(msgBody.Text)) <> 0 then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
idMessage.ContentType := 'text/html' ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
if msgBody <> nil then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
IdMessage.Body.Assign(msgBody) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
t := now ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
while (SMTP.Connected) and<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
(now < t + 10 * (1/86400)) do // 10 Seconds<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
sleep(10) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
if Assigned(Attachments) then<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
for i := 0 to pred(Attachments.Count) do<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
TIdAttachmentFile.Create(IdMessage.MessageParts,
Attachments[i]) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Host := ASettings.SMTPServer ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Port := ASettings.SMTPPort ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Username := ASettings.Username ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Password := ASettings.Password ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Connect ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
try<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Send(idMessage) ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
finally<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Disconnect ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
end ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
finally<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
SMTP.Free ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
IdMessage.Free ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
end;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
end;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
except<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
EmailFailed := True ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">
end ;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);">end
;<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color: rgb(31, 73, 125);"><o:p> </o:p></span></p>
<div>
<div style="border-right: medium none; border-width: 1pt
medium medium; border-style: solid none none; border-color:
rgb(181, 196, 223) -moz-use-text-color -moz-use-text-color;
padding: 3pt 0cm 0cm;">
<p class="MsoNormal"><b><span style="font-size: 10pt;
font-family:
"Tahoma","sans-serif";"
lang="EN-US">From:</span></b><span style="font-size:
10pt; font-family:
"Tahoma","sans-serif";" lang="EN-US">
<a class="moz-txt-link-abbreviated" href="mailto:delphi-bounces@delphi.org.nz">delphi-bounces@delphi.org.nz</a>
[<a class="moz-txt-link-freetext" href="mailto:delphi-bounces@delphi.org.nz">mailto:delphi-bounces@delphi.org.nz</a>] <b>On Behalf Of </b>John
Bird<br>
<b>Sent:</b> Tuesday, 12 July 2011 1:47 p.m.<br>
<b>To:</b> NZ Borland Developers Group - Delphi List<br>
<b>Subject:</b> [DUG] Email/SMTP code<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">Anyone got a recommendation for the
best (free) code/samples to drive Indy10 for sending
an email with attachment<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">-Indy10.2.3<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">-Send attachment<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">-SMTP server and email addresses will
be known<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">I have tried a couple (eg AtoZed
SendMail example) but it seems to time out connecting
to the SMTP <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;"> <o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;">John<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size: 10pt;
font-family: "Arial","sans-serif";
color: black;"> <o:p></o:p></span></p>
</div>
</div>
</div>
</div>
<br>
<br>
__________ Information from ESET Smart Security, version of virus
signature database 6285 (20110711) __________<br>
<br>
The message was checked by ESET Smart Security.<br>
<br>
<a moz-do-not-send="true" href="http://www.eset.com">http://www.eset.com</a><br>
<pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
NZ Borland Developers Group - Delphi mailing list
Post: <a class="moz-txt-link-abbreviated" href="mailto:delphi@delphi.org.nz">delphi@delphi.org.nz</a>
Admin: <a class="moz-txt-link-freetext" href="http://delphi.org.nz/mailman/listinfo/delphi">http://delphi.org.nz/mailman/listinfo/delphi</a>
Unsubscribe: send an email to <a class="moz-txt-link-abbreviated" href="mailto:delphi-request@delphi.org.nz">delphi-request@delphi.org.nz</a> with Subject: unsubscribe
__________ Information from ESET Smart Security, version of virus signature database 6285 (20110711) __________
The message was checked by ESET Smart Security.
<a class="moz-txt-link-freetext" href="http://www.eset.com">http://www.eset.com</a>
</pre>
</blockquote>
<br>
</body>
</html>