Loading ...
Sorry, an error occurred while loading the content.
 

Re:[tmail2000] How do I send embedded picture?

Expand Messages
  • Kunikazu Okada
    John, ... It depends on your language . I tested this example with CharSet = us-ascii, TextEncoding = etNoEncoding. Memo1.Lines = ( Test
    Message 1 of 3 , Nov 30, 2001
      John,
      > Can anyone post me an example of how to send an embedded picture in
      > an email.

      > What type of text encoding do I need to use on the message
      > component and AttachFile method etc.

      It depends on your language .
      I tested this example with CharSet = us-ascii, TextEncoding = etNoEncoding.

      Memo1.Lines = (
      <HTML>
      <HEAD>Test</HEAD>
      <BODY>
      This is a test message<BR>
      <IMG src=cid:RedButton.gif><BR>
      Can you see this picture ?
      </BODY>
      </HTML>
      )

      The point is that you should refer to the attached image
      by "cid:filename".

      Then here is the code:

      procedure TForm1.Button1Click(Sender: TObject);
      begin
      with MailMsg do begin
      Reset;
      ToList.Add('','kunikazu@...');
      SetFrom('','kunikazu@...');
      Subject := 'Test';

      SetTextPlain('This is a test');
      SetTextHtml(Memo1.Lines.Text);
      AttachFile('C:\Data\images\RedButton.gif', 'image/gif', etBase64, True);

      RebuildBody;
      //DebugPrint(MessageSource);
      end;

      with SMTP do begin
      Connect;
      SendMessage;
      Quit;
      end;
      end;

      At least, I could view the HTML embedded image with Microsoft Outlook 2000.

      /// Kunikazu OKADA ~~~~~~~~~~~~~~~~~~~~~~~~~~~
      Teppi Technology LLC ( http://www.teppi.com ),
      Tokyo, Japan ___________________________________________///
    • john@gbasolutions.co.uk
      Kunikazu Many thanks for your help. what you sent me worked very well. Should I be able to embed more that one picture file? Is this also supposed to
      Message 2 of 3 , Dec 5, 2001
        RE: RE: [tmail2000] How do I send embedded picture?

        Kunikazu
        Many thanks for your help.  what you sent me worked very well.
        Should I be able to embed more that one picture file?
        Is this also supposed to work...When I run it, I only see the first picture.

        <HTML>
        <HEAD>Test</HEAD>
        <BODY>
          This is a test message<BR>
          <IMG src=cid:RedButton.gif><BR>
          Can you see this picture ? 
          <IMG src=cid:picture.jpg><BR>
          Can you see this JPEG picture ?
          <IMG src=cid:anotherpicture.bmp><BR>
          Can you see this BMP picture ?
        </BODY>
        </HTML>

        Many Thanks
        John

        -----Original Message-----
        From: Kunikazu Okada [mailto:kunikazu@...]
        Sent: 30 November 2001 10:55 AM
        To: tmail2000@yahoogroups.com
        Subject: Re:[tmail2000] How do I send embedded picture?


        John,
        > Can anyone post me an example of how to send an embedded picture in
        > an email. 

        > What type of text encoding do I need to use on the message
        > component and AttachFile method etc.

        It depends on your language .
        I tested this example with CharSet = us-ascii, TextEncoding = etNoEncoding.

        Memo1.Lines = (
        <HTML>
        <HEAD>Test</HEAD>
        <BODY>
          This is a test message<BR>
          <IMG src=cid:RedButton.gif><BR>
          Can you see this picture ?
        </BODY>
        </HTML>
        )

        The point is that you should refer to the attached image
         by "cid:filename".
         
        Then here is the code:

        procedure TForm1.Button1Click(Sender: TObject);
        begin
          with MailMsg do begin
            Reset;
            ToList.Add('','kunikazu@...');
            SetFrom('','kunikazu@...');
            Subject := 'Test';
           
            SetTextPlain('This is a test');
            SetTextHtml(Memo1.Lines.Text);
            AttachFile('C:\Data\images\RedButton.gif', 'image/gif', etBase64, True);
           
            RebuildBody;
            //DebugPrint(MessageSource);
          end;

          with SMTP do begin
            Connect;
            SendMessage;
            Quit;
          end;   
        end;

        At least, I could view the HTML embedded image with Microsoft Outlook 2000.

        /// Kunikazu OKADA   ~~~~~~~~~~~~~~~~~~~~~~~~~~~
        Teppi Technology LLC ( http://www.teppi.com ),
        Tokyo, Japan ___________________________________________///


        ------------------------ Yahoo! Groups Sponsor ---------------------~-->
        Universal Inkjet Refill Kit $29.95
        Refill any ink cartridge for less!
        Includes black and color ink.
        http://us.click.yahoo.com/f00vhB/MkNDAA/ySSFAA/i7folB/TM
        ---------------------------------------------------------------------~->

        =============================================================

        The group's home page is here:
          http://groups.yahoo.com/group/tmail2000/

        To post a message:
          send email to: tmail2000@yahoogroups.com  
          or go here: http://groups.yahoo.com/group/tmail2000/post

        To modify your subcription options (e.g. stop receiving discussions)
        go to:
          http://groups.yahoo.com/mygroups/tmail2000/join or
          http://groups.yahoo.com/convwiz

        To subscribe/unsubscribe, send blank email to:
          tmail2000-subscribe@yahoogroups.com
          tmail2000-unsubscribe@yahoogroups.com

        To talk only with the moderator, developer of TMail2000, write email to:
          mycelo@...

        Please expect 1-2 weeks for my response.

        PLEASE POST IN ENGLISH!
         

        Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/



      Your message has been successfully submitted and would be delivered to recipients shortly.