Re: [twsocket] Sending mail with SMTPClient including images

2008-04-17 Thread Jeff Cook
Back again after a spell of frantically doing other stuff ...

I do indeed have the THtmlSmtpClient, but am perplexed as to how to use
it.  

I have my RichEdit with (or without) images, and I can see that:-

TSmtpClient has a property MailMessage
and
THtmlSmtpClient has EmailImages and HtmlText

... But what to I do with them.

Currently I use:-
 
procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject;
  LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More:
Boolean);
var
  Len: Integer;
begin
  if LineNum  sl.Count then
More := FALSE
  else begin
Len := Length(sl.Strings[LineNum - 1]);
{ Truncate the line if too long (should wrap to next line) }
if Len = MaxLen then
  StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen - 1))
else
  StrPCopy(MsgLine, sl.Strings[LineNum - 1]);
  end;
end;

... To feed the lines from string list sl 

Any help appreciated

TIA

Jeff

--
Jeff Cook
Aspect Systems Ltd
Phone: +682 28 213
Skype: jeffraro
www.aspect.co.nz 

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Wilfried Mestdagh
Sent: Tuesday, 8 April 2008 8:10 p.m.
To: ICS support mailing
Subject: Re: [twsocket] Sending mail with SMTPClient including images


Hello Jeff,

You should have it installed unless you have a very old version of ICS.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Tuesday, April 8, 2008, 21:59, Jeff Cook wrote:

 Kia Orana Wilfred

 Perhaps THtmlSmtpClient is just what I need - I'm not very bright in

 the email/html department, so a component that does it all for me 
 sounds the thing for me!

 BUT ... I can't find it anywhere - tried Googling with no success.

 Any pointers as to where I'd find it - I'm developing with Delphi 6 if

 that makes any difference.

 Meitaki Ma'ata

 Kia Manuia

 Jeff
 --
 Jeff Cook
 The Cooks Oasis
 The Cooks Ltd
 Phone: +682 28 213
 Skype: jeffraro
 www.cookislandsoasis.com
 


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Wilfried Mestdagh
 Sent: Monday, 7 April 2008 8:57 p.m.
 To: ICS support mailing
 Subject: Re: [twsocket] Sending mail with SMTPClient including images


 Hello Jeff,

 the image gets stripped on the way out.  I DON'T want to have the 
 image sent as an attachment (can already do that) but want it in the 
 body of the email itself.

 The HTML part is an attachment and the images are also attachments. If
 you want the images in the html document you have to reference them in
 the html document in the right sequence.

 A correct email also have a plain text. So if you want to send HTML
 email with a reference to an image you put the plain text in the body,
 the HTML as attachment and the image also.

 Check also THtmlSmtpClient. I think as the name say it will handle a
 large part of it for you.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 -- 
 To unsubscribe or change your settings for TWSocket mailing list
please
 goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-09 Thread Wilfried Mestdagh
Hello Jeff,

You should have it installed unless you have a very old version of ICS.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

Tuesday, April 8, 2008, 21:59, Jeff Cook wrote:

 Kia Orana Wilfred

 Perhaps THtmlSmtpClient is just what I need - I'm not very bright in
 the email/html department, so a component that does it all for me sounds
 the thing for me!

 BUT ... I can't find it anywhere - tried Googling with no success.

 Any pointers as to where I'd find it - I'm developing with Delphi 6 if
 that makes any difference.

 Meitaki Ma'ata

 Kia Manuia

 Jeff
 --
 Jeff Cook
 The Cooks Oasis
 The Cooks Ltd
 Phone: +682 28 213
 Skype: jeffraro
 www.cookislandsoasis.com 
 


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 On Behalf Of Wilfried Mestdagh
 Sent: Monday, 7 April 2008 8:57 p.m.
 To: ICS support mailing
 Subject: Re: [twsocket] Sending mail with SMTPClient including images


 Hello Jeff,

 the image gets stripped on the way out.  I DON'T want to have the 
 image sent as an attachment (can already do that) but want it in the 
 body of the email itself.

 The HTML part is an attachment and the images are also attachments. If
 you want the images in the html document you have to reference them in
 the html document in the right sequence.

 A correct email also have a plain text. So if you want to send HTML
 email with a reference to an image you put the plain text in the body,
 the HTML as attachment and the image also.

 Check also THtmlSmtpClient. I think as the name say it will handle a
 large part of it for you.

 ---
 Rgds, Wilfried [TeamICS]
 http://www.overbyte.be/eng/overbyte/teamics.html
 http://www.mestdagh.biz

 -- 
 To unsubscribe or change your settings for TWSocket mailing list please
 goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-08 Thread Francois Piette
Hi Jeff,

Dod is talking about HTML email and you are talking about RTF email. Not the
same format.

btw: I think RTF email is only used by old Microsoft software. Currently all
email software use HTML emails.

Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html
--
[EMAIL PROTECTED]
Author of ICS (Internet Component Suite, freeware)
Author of MidWare (Multi-tier framework, freeware)
http://www.overbyte.be

- Original Message - 
From: Jeff Cook [EMAIL PROTECTED]
To: 'ICS support mailing' twsocket@elists.org
Sent: Tuesday, April 08, 2008 1:25 AM
Subject: Re: [twsocket] Sending mail with SMTPClient including images


 Hi Dod

 I understand this bit (I think):-

  but an image in a mail is a  BASE64  encoded  attachement  so  if  you

  convert HTMLToString then you'll  only  get  the  HTML  text part of
 your mail, not the attached binary files like
  images.

 But here, I'm not with you

  To do this you may have to decode attached picture into its orignal
 non BASE64
  fomrmat then load it into you RichEdit.

 ... Because I have already loaded the image  (Code below).

 The effect I'm trying to get is exactly like (say) MS Outlook where, in
 HTML format mails, you can enter formatted text and past images e.g. a
 screen shot.  I can get that far with what I have written, except that
 the image gets stripped on the way out.  I DON'T want to have the image
 sent as an attachment (can already do that) but want it in the body of
 the email itself.

 Cheers

 Jeff
 
 This is how the image gets into the richedit:-

   i := 0;
   while i = 0 do
   begin
 i := BodyText.FindText('{Other|Photo}', 0, MaxInt, []);
 if i = 0 then
 begin
   BodyText.SelStart := i;
   BodyText.SelLength := 13;
   with Common.dlgOpenPicture do
   begin
 InitialDir := Common.GetPreference('Photo Location');
 if Execute then
 begin
   Pict := TPicture.Create;
   try
 Pict.LoadFromFile(FileName);
 BodyText.InsertGraphic(Pict.Graphic, True);
   finally
 Pict.Free;
   end;
 end
 else break;
   end;
 end;
   end;

 

 JC Hi

 JC Currently I have a program that works 99% OK ;-)

 JC I compose a rich text email in

 JC BodyText: TJvRichEdit;

 JC and I send it with code like this:-

 JC   if BodyText.PlainText then sl.Text := BodyText.Text
 JC   else Common.JvRichEditToHtml.ConvertToHtmlStrings(BodyText,
 JC sl);

 JC where sl is a TStringList.

 JC Then (code that was straight out of an example) :-

 JC procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject;
 JC   LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More:
 JC Boolean); var
 JC   Len: Integer;
 JC begin
 JC   if LineNum  sl.Count then
 JC More := FALSE
 JC   else begin
 JC Len := Length(sl.Strings[LineNum - 1]);
 JC { Truncate the line if too long (should wrap to next line) }
 JC if Len = MaxLen then
 JC   StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen -
 1))
 JC else
 JC   StrPCopy(MsgLine, sl.Strings[LineNum - 1]);
 JC   end;
 JC end;

 JC Now this works and we get nicely formatted emails sent out.  EXCEPT
 JC when the user puts an Image into the BodyText (TJvRichEdit).

 JC In this case the image is simply dropped.

 JC I'm hoping that there is a simple solution that doesn't involve
 JC rewriting too much !

 JC --

 JC Jeff Cook

 JC The Cooks Oasis

 JC The Cooks Ltd

 JC Phone: +682 28 213

 JC Skype: jeffraro

 JC www.cookislandsoasis.com http://www.cookislandsoasis.com/


 JC
 http://fta.firetrust.com/index.cgi?id=jeffraroamp;page=1amp;campaign=
 aspect_email I use and recommend MailWasher Pro to keep my mailbox
 JC clear of SPAM


 -- 
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be

 -- 
 To unsubscribe or change your settings for TWSocket mailing list
 please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
 Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-08 Thread Wilfried Mestdagh
Hello Jeff,

 the image gets stripped on the way out.  I DON'T want to have the image
 sent as an attachment (can already do that) but want it in the body of
 the email itself. 

The HTML part is an attachment and the images are also attachments. If
you want the images in the html document you have to reference them in
the html document in the right sequence.

A correct email also have a plain text. So if you want to send HTML
email with a reference to an image you put the plain text in the body,
the HTML as attachment and the image also.

Check also THtmlSmtpClient. I think as the name say it will handle a
large part of it for you.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-08 Thread Jeff Cook
Kia Orana Wilfred

Perhaps THtmlSmtpClient is just what I need - I'm not very bright in
the email/html department, so a component that does it all for me sounds
the thing for me!

BUT ... I can't find it anywhere - tried Googling with no success.

Any pointers as to where I'd find it - I'm developing with Delphi 6 if
that makes any difference.

Meitaki Ma'ata

Kia Manuia

Jeff
--
Jeff Cook
The Cooks Oasis
The Cooks Ltd
Phone: +682 28 213
Skype: jeffraro
www.cookislandsoasis.com 
 


-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Wilfried Mestdagh
Sent: Monday, 7 April 2008 8:57 p.m.
To: ICS support mailing
Subject: Re: [twsocket] Sending mail with SMTPClient including images


Hello Jeff,

 the image gets stripped on the way out.  I DON'T want to have the 
 image sent as an attachment (can already do that) but want it in the 
 body of the email itself.

The HTML part is an attachment and the images are also attachments. If
you want the images in the html document you have to reference them in
the html document in the right sequence.

A correct email also have a plain text. So if you want to send HTML
email with a reference to an image you put the plain text in the body,
the HTML as attachment and the image also.

Check also THtmlSmtpClient. I think as the name say it will handle a
large part of it for you.

---
Rgds, Wilfried [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html
http://www.mestdagh.biz

-- 
To unsubscribe or change your settings for TWSocket mailing list please
goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] Sending mail with SMTPClient including images

2008-04-07 Thread Jeff Cook
Hi
 
Currently I have a program that works 99% OK ;-)
 
I compose a rich text email in 
 
BodyText: TJvRichEdit;
 
and I send it with code like this:-
 
  if BodyText.PlainText then sl.Text := BodyText.Text
  else Common.JvRichEditToHtml.ConvertToHtmlStrings(BodyText, sl);

where sl is a TStringList.
 
Then (code that was straight out of an example) :-
 
procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject;
  LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More:
Boolean);
var
  Len: Integer;
begin
  if LineNum  sl.Count then
More := FALSE
  else begin
Len := Length(sl.Strings[LineNum - 1]);
{ Truncate the line if too long (should wrap to next line) }
if Len = MaxLen then
  StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen - 1))
else
  StrPCopy(MsgLine, sl.Strings[LineNum - 1]);
  end;
end;

Now this works and we get nicely formatted emails sent out.  EXCEPT when
the user puts an Image into the BodyText (TJvRichEdit).
 
In this case the image is simply dropped.
 
I'm hoping that there is a simple solution that doesn't involve
rewriting too much !

--

Jeff Cook

The Cooks Oasis

The Cooks Ltd

Phone: +682 28 213

Skype: jeffraro

www.cookislandsoasis.com http://www.cookislandsoasis.com/  

 
http://fta.firetrust.com/index.cgi?id=jeffraroamp;page=1amp;campaign=
aspect_email I use and recommend MailWasher Pro to keep my mailbox
clear of SPAM

 
-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-07 Thread Dod
Hello Jeff,

I  don't understand very well what you mean, but an image in a mail is
a  BASE64  encoded  attachement  so  if  you convert HTMLToString then
you'll  only  get  the  HTML  text part of your mail, not the attached
binary files like images.

To do this you may have to decode attached picture into its orignal
non BASE64 fomrmat then load it into you RichEdit.

regards.

JC Hi
 
JC Currently I have a program that works 99% OK ;-)
 
JC I compose a rich text email in 
 
JC BodyText: TJvRichEdit;
 
JC and I send it with code like this:-
 
JC   if BodyText.PlainText then sl.Text := BodyText.Text
JC   else Common.JvRichEditToHtml.ConvertToHtmlStrings(BodyText, sl);

JC where sl is a TStringList.
 
JC Then (code that was straight out of an example) :-
 
JC procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject;
JC   LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More:
JC Boolean);
JC var
JC   Len: Integer;
JC begin
JC   if LineNum  sl.Count then
JC More := FALSE
JC   else begin
JC Len := Length(sl.Strings[LineNum - 1]);
JC { Truncate the line if too long (should wrap to next line) }
JC if Len = MaxLen then
JC   StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen - 1))
JC else
JC   StrPCopy(MsgLine, sl.Strings[LineNum - 1]);
JC   end;
JC end;

JC Now this works and we get nicely formatted emails sent out.  EXCEPT when
JC the user puts an Image into the BodyText (TJvRichEdit).
 
JC In this case the image is simply dropped.
 
JC I'm hoping that there is a simple solution that doesn't involve
JC rewriting too much !

JC --

JC Jeff Cook

JC The Cooks Oasis

JC The Cooks Ltd

JC Phone: +682 28 213

JC Skype: jeffraro

JC www.cookislandsoasis.com http://www.cookislandsoasis.com/  

 
JC http://fta.firetrust.com/index.cgi?id=jeffraroamp;page=1amp;campaign=
aspect_email I use and recommend MailWasher Pro to keep my mailbox
JC clear of SPAM


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


Re: [twsocket] Sending mail with SMTPClient including images

2008-04-07 Thread Jeff Cook
Hi Dod

I understand this bit (I think):-

 but an image in a mail is a  BASE64  encoded  attachement  so  if  you

 convert HTMLToString then you'll  only  get  the  HTML  text part of
your mail, not the attached binary files like 
 images.

But here, I'm not with you

 To do this you may have to decode attached picture into its orignal
non BASE64 
 fomrmat then load it into you RichEdit.

... Because I have already loaded the image  (Code below).

The effect I'm trying to get is exactly like (say) MS Outlook where, in
HTML format mails, you can enter formatted text and past images e.g. a
screen shot.  I can get that far with what I have written, except that
the image gets stripped on the way out.  I DON'T want to have the image
sent as an attachment (can already do that) but want it in the body of
the email itself. 

Cheers

Jeff

This is how the image gets into the richedit:-

  i := 0;
  while i = 0 do
  begin
i := BodyText.FindText('{Other|Photo}', 0, MaxInt, []);
if i = 0 then
begin
  BodyText.SelStart := i;
  BodyText.SelLength := 13;
  with Common.dlgOpenPicture do
  begin
InitialDir := Common.GetPreference('Photo Location');
if Execute then
begin
  Pict := TPicture.Create;
  try
Pict.LoadFromFile(FileName);
BodyText.InsertGraphic(Pict.Graphic, True);
  finally
Pict.Free;
  end;
end
else break;
  end;
end;
  end;
  


JC Hi
 
JC Currently I have a program that works 99% OK ;-)
 
JC I compose a rich text email in
 
JC BodyText: TJvRichEdit;
 
JC and I send it with code like this:-
 
JC   if BodyText.PlainText then sl.Text := BodyText.Text
JC   else Common.JvRichEditToHtml.ConvertToHtmlStrings(BodyText, 
JC sl);

JC where sl is a TStringList.
 
JC Then (code that was straight out of an example) :-
 
JC procedure TSMTPMailMsgForm.SmtpClientGetData(Sender: TObject;
JC   LineNum: Integer; MsgLine: Pointer; MaxLen: Integer; var More: 
JC Boolean); var
JC   Len: Integer;
JC begin
JC   if LineNum  sl.Count then
JC More := FALSE
JC   else begin
JC Len := Length(sl.Strings[LineNum - 1]);
JC { Truncate the line if too long (should wrap to next line) }
JC if Len = MaxLen then
JC   StrPCopy(MsgLine, Copy(sl.Strings[LineNum - 1], 1, MaxLen -
1))
JC else
JC   StrPCopy(MsgLine, sl.Strings[LineNum - 1]);
JC   end;
JC end;

JC Now this works and we get nicely formatted emails sent out.  EXCEPT 
JC when the user puts an Image into the BodyText (TJvRichEdit).
 
JC In this case the image is simply dropped.
 
JC I'm hoping that there is a simple solution that doesn't involve 
JC rewriting too much !

JC --

JC Jeff Cook

JC The Cooks Oasis

JC The Cooks Ltd

JC Phone: +682 28 213

JC Skype: jeffraro

JC www.cookislandsoasis.com http://www.cookislandsoasis.com/

 
JC
http://fta.firetrust.com/index.cgi?id=jeffraroamp;page=1amp;campaign=
aspect_email I use and recommend MailWasher Pro to keep my mailbox
JC clear of SPAM


-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

-- 
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be