New call-to-action
Results 1 to 20 of 20

Thread: How to insert a signature image into an email

  1. #1
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default How to insert a signature image into an email

    Hi All

    We like to include a small App within our applications so the Runtime user can send emails from within the App.

    We would like to be able to show their logo as a signature at the end of the message can anyone please modify the script on the Send button of the attached application. The script at the moment sends the email and creates a log table. I have been using function Email_send2().

    Grateful if someone could modify this script to show the Cards image.

    Michael
    Attached Files Attached Files

  2. #2
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    Michael,

    I believe you'll have to use the html_message sub variable to include an inline image. You will need to reference the image by the path on the machine where the script is run.

    Code:
    Parentform.commit()
    t=table.current()
    dim message as P
    
    message.message = t.message
    message.from_alias=t.from
    If t.attachpath<>"" then
    message.attachments=rtrim(t.ATTACHPATH)
    End If
    message.1related = .t.
    message.to = t.address
    message.subject = t.subject
    message.html_message = <<%html%
    This is a message with an 
    <img src="C:\tempdb\Emailsender\cards.png">
    inline image.
    %html%
    'silent, store in mailbox,autowrap all set to false
    result=email_send2(message, "", .F., .F., .F.)
    if result=.t. then
        ui_msg_box("Note","Email sent")
        ELSE
    ui_msg_box("Note","Email failed")
    END
    End If
    There can be only one.

  3. #3
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    I just noticed that the code suggested displays the image in the email if it is viewed on a machine where the image exists in the location specified. If you reference a web based image such as

    <img src="http://www.alphasoftware.com/images/awards.gif">

    then it will display while online.
    There can be only one.

  4. #4
    "Certified" Alphaholic Keith Hubert's Avatar
    Real Name
    Keith Hubert
    Join Date
    Jul 2000
    Location
    London, UK
    Posts
    6,930

    Default Re: How to insert a signature image into an email

    Hi Michael,

    What about saving the image in the Code tab? Then it will be available in the runtime, wont it?
    Regards
    Keith Hubert
    Alpha Guild Member
    London.
    KHDB Management Systems
    Skype = keith.hubert


    For your day-to-day Needs, you Need an Alpha Database!

  5. #5
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stan,

    Thanks, this is now showing the image so if we store each of our users images on our own server then the links should work for us. I now need to get the value from the 't.message' memo field into the html brackets, it was using plain text before and worked OK but cannot figure how to code the value of t.message into the body of the email can you please help with this.

    Thanks again

    Michael

  6. #6
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    Just bits and pieces.

    Shown as constructed in the interactive.

    Code:
    'dummy construction to establish a variable for experimentation
    'your actual code will just use the table field value as at present
    t.message = "This is a message"+crlf()+"from Michael Humby"
    
    'see how it looks
    ? t.message
    = This is a message
    from Michael Humby
    
    'construct the message.html_message as will be used by email_send2()
    message.html_message = "<<%html%" + crlf()+ t.message+crlf() + "<img src=\"C:\tempdb\Emailsender\cards.png\">"+crlf()+"%html%"
    
    'see how it looks
    ? message.html_message
    = <<%html%
    This is a message
    from Michael Humby
    <img src="C:\tempdb\Emailsender\cards.png">
    %html%
    There can be only one.

  7. #7
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    Were you able to get what you wanted out of this Michael?
    There can be only one.

  8. #8
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stan,

    Not had chance to experiment yet, been a bit hectic here. The image is now OK but over the weekend I hope to find time to try your example of interactive code to bring in the user's message together with the image.

    Thanks again

    Michael

  9. #9
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stan,

    I can now send either (A) Plain text message or (B) Signature Image but still cannot get both together see A and B below. I've tried using your suggestion of
    message.html_message = "<<%html%" + crlf()+ t.message+crlf() + "<img src=\"C:\tempdb\Emailsender\cards.png\">"+crlf()+"%html%"
    and replaced 't.message' with a character variable holding the value of the memo field holding the message

    I've also tried switching the memo field to RTF memo using the *bin_to_rtf() function

    Dim tbl as p
    dim rtftext as c
    tbl=table.current()
    tbl.fetch_first()
    rtftext.VALUE= *bin_to_rtf(tbl.htmessage)
    and replacing t.message with the rtftext value i.e.
    {\rtf1\ansi \deff0{\colortbl;\red0\green0\blue0;}{\fonttbl{\f0\fswiss Tahoma;}}{{\f0 \cf1 \fs16 Dear Jack\par \par This is my rtf message\par \par \par OK\par From Me}}}


    (A)
    t=table.current()
    dim message as P

    message.message = t.message
    message.from_alias=t.from
    If t.attachpath<>"" then
    message.attachments=rtrim(t.ATTACHPATH)
    End If
    message.1related = .t.
    message.to = t.address
    message.subject = t.subject
    'silent, store in mailbox,autowrap all set to false
    result=email_send2(message, "", .F., .F., .F.)
    if result=.t. then
    ui_msg_box("Note","Email sent")
    ELSE
    ui_msg_box("Note","Email failed")
    END
    End If

    (B)
    t=table.current()
    'the value in t.message is a memo field
    vv_messagetext=t.message
    dim message as P

    message.from_alias=t.from
    If t.attachpath<>"" then
    message.attachments=rtrim(t.ATTACHPATH)
    End If
    message.1related = .t.
    message.to = t.address
    message.subject = t.subject

    message.html_message = <<%html%

    This is a message with an image signature but how do I replace this text with the values stored in vv_messagetext variable
    <br />
    <br />
    <img src="http://www.instantnurserymanager.co.uk/dls/cards.png">

    %html%
    'silent, store in mailbox and autowrap options all set to false
    result=email_send2(message, "", .F., .F., .F.)
    if result=.t. then
    ui_msg_box("Note","Email sent")
    ELSE
    ui_msg_box("Note","Email failed")
    END
    End If

    Michael
    Last edited by Michael Humby; 03-22-2014 at 03:07 PM.

  10. #10
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    I'm not certain you can use rtf formatting in an html message. You'll probably have to use html formatting.

    If you just want the message in the table field

    message.html_message = "<<%html%"+crlf()+ t.message+crlf()+"<br />"+crlf()+"<br />"+crlf()+"<img src="http://www.instantnurserymanager.co.uk/dls/cards.png">"+crlf()+"%html%"
    Last edited by Stan Mathews; 03-22-2014 at 11:19 PM.
    There can be only one.

  11. #11
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stand,

    Which type of field do you think the message field should be, Memo or RTFMemo?

    Michael

  12. #12
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    If you intend to use the html message with the signature image I would think it would be much easier with a plain memo and adding html formatting.
    There can be only one.

  13. #13
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stan,

    Using this line

    message.html_message = "<<%html%"+crlf()+ RTRIM(vv_messagetext)+crlf()+"<br />"+crlf()+"<br />"+crlf()+"<img src=\"http://www.instantnurserymanager.co.uk/dls/cards.png\">"+crlf()+"%html%"

    This is what i getWhatiget.png

    The text is no longer formatted and tags show at beginning and end, any ideas?

    Michael

  14. #14
    Member
    Real Name
    Allen Klimeck
    Join Date
    Apr 2000
    Location
    Colorado
    Posts
    549

    Default Re: How to insert a signature image into an email

    Michael I think the best construct is:

    Code:
    message.html_message = <<%html%
    
     This is a message with an image signature but how do I replace this text with the values stored in vv_messagetext variable
     <br />
     <br />
     <img src="http://www.instantnurserymanager.co.uk/dls/cards.png">
    %html%
    to replace the static text you would use:

    Code:
    message.html_message = <<%html%
    
     aplaceholderfortxt
     <br />
     <br />
     <img src="http://www.instantnurserymanager.co.uk/dls/cards.png">
    %html%
     
    message.html_message = strtran(message.html_message,"aplaceholderfortxt",t.message)'no need for the variable.
    aplaceholderfortxt can be any thing it just has to be the same in the text & the strtran() function. But not some thing that might be in the text because the function would replace all occurrences of it. You can use the strtran() function to replace as many place holders as you need.
    Last edited by Allen Klimeck; 03-23-2014 at 03:12 PM.

  15. #15
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Allen,

    Thanks, I am nearly there now with this:

    message.html_message = <<%html%

    aplaceholderfortxt
    <br />
    <br />
    <img src="http://www.instantnurserymanager.co.uk/dls/cards.png">
    %html%

    message.html_message = strtran(message.html_message,"aplaceholderfortxt",t.message)

    This is the result but I still don't get the layout of the message with spaces and carriage returns Whatiget2.png

    Thanks

    Michael

  16. #16
    "Certified" Alphaholic Stan Mathews's Avatar
    Real Name
    Stan Mathews
    Join Date
    Apr 2000
    Location
    Bowling Green, KY
    Posts
    25,119

    Default Re: How to insert a signature image into an email

    Michael,

    Are you saying you want the message formatted like

    Dear Jack and Julie,
    Hi All, hope you have enjoyed a good weekend.
    ..................

    As suggested, you will have to use html formatting. The message in the table field should be

    Dear Jack and Julie,<br>
    Hi All, hope you have enjoyed a good weekend.<br>
    ............................<br>
    There can be only one.

  17. #17
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Stan,

    Yes, I need to capture the user's original format as:

    t=table.current()
    dim message as P

    message.message = t.message
    message.from_alias=t.from
    If t.attachpath<>"" then
    message.attachments=rtrim(t.ATTACHPATH)
    End If
    message.1related = .t.
    message.to = t.address
    message.subject = t.subject

    This results OK but I am then back to square one and cannot show the signature image Whatiget3.png

    Should I be needing the *RTF_TO_HTML() function?

    Michael

  18. #18
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Thanks Allen & Stan.

    I have now changed the t.message field to html memo and the result is formatted with the signature logo as expected and i'm using :

    message.html_message = <<%html%

    aplaceholderfortxt
    <br />
    <br />
    <img src="http://www.instantnurserymanager.co.uk/dls/cards.png">
    %html%

    message.html_message = strtran(message.html_message,"aplaceholderfortxt",t.htmlfield) 'htmlfield is now the old message field

    At some stage i will post the app for others to use.

    Thanks again
    Michael

  19. #19
    Member
    Real Name
    Alex Muir
    Join Date
    Nov 2000
    Location
    Stocksfield UK
    Posts
    460

    Default Re: How to insert a signature image into an email

    Hello Michael

    I have tried incorporating a signature graphic as html code in the email footer but this is simply translated into a string of text?

    What am I doing incorrectly?

    Kind regards

    Alex
    Database Software Solutions Limited
    www.dbasesolution.co.uk
    PRECISE360 -
    LYNCHPIN -

  20. #20
    "Certified" Alphaholic
    Real Name
    Michael Humby
    Join Date
    Apr 2000
    Location
    Leicester, UK
    Posts
    1,036

    Default Re: How to insert a signature image into an email

    Hello Alex,

    I changed the field type from Memo to HTML Memo and this now seem OK, I shall shortly be posting a sample app that can easily be incorporated into your own apps.

    On another subject I think I spoke with you some years ago, are you still running your 'Blinds Software'?

    Michael

Similar Threads

  1. Signature Image is showing a block box on PDF
    By UODTech in forum Mobile & Browser Applications
    Replies: 10
    Last Post: 09-17-2014, 09:40 PM
  2. Insert image from URL
    By SuperMarc92 in forum Alpha Five Version 11 - Desktop Applications
    Replies: 1
    Last Post: 10-01-2013, 04:59 PM
  3. Not able to add the Signature to the signature object using the TOPAZ device
    By vckumareshbabu in forum Alpha Five Version 9 - Desktop Applications
    Replies: 1
    Last Post: 12-07-2009, 08:08 AM
  4. Insert Logo (image) in my invoice
    By cbauer50 in forum Alpha Four Version 6 and Prior
    Replies: 7
    Last Post: 08-03-2009, 06:23 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •