2013 Sep 04 3:54 PM
Hi,
i use this code to send an email via Outlook:
CREATE OBJECT LR_OU 'Outlook.Application'.
CALL METHOD OF LR_OU 'CreateItem' = LR_MI
EXPORTING #1 = 0.
*
SET PROPERTY OF LR_MI 'To' = '[email protected]'.
*
SET PROPERTY OF LR_MI 'Subject' = 'Subject'.
*
SET PROPERTY OF LR_MI 'Body' = 'Bodytext'.
*
CALL METHOD OF LR_MI 'Display'.
*
FREE OBJECT LR_OU.
This works OK but i missed my Default signature from Outlook, therfore i have to set the
button signature in the Email.
Is it possible to set any proberty to set the Default signature?
Is there an documentation to use Outlook.Application?
Thnaks.
Regards, Dieter
2013 Sep 06 1:13 PM
As far as I remember (no VBA since some years now) the signature is there by default, but it was erased when body of the mail was changed (it is part of the body). So you could try to read the body (GET PROPERTY), then add a new-line and the signature to your Abap mail body and set it back in the mail ?
NB:
- you may need to have another call of display method (to be able to read signature)
- you could test, comment the property set of body, does the mail contain the default signature
Regards,
Raymond
2013 Sep 05 7:09 AM
Hi Dieter,
The signatures are local to the user and will work only in foreground mode....
You will need to upload the signature from the local file....
DATA: OS_USER TYPE STRING .
CALL METHOD CL_GUI_FRONTEND_SERVICES=>GET_USER_NAME
CHANGING
USER_NAME = OS_USER
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
NOT_SUPPORTED_BY_GUI = 3
OTHERS = 4.
Filename =
"C:\Documents and Settings\" + OS_USER + "\Application Data\Microsoft\Signatures\" + outlook_user + "." + file_ext.
Read this file and add it to the body text.
Regards
2013 Sep 05 7:54 AM
Hi Mohammed,
thanks for your answer. I find the signature as you has shown. The Problem is, that we have in this signature some formatted text.
I hoped there will be some possibility, to use some proberty or method from 'Outlook.Application' that simulate the button 'signature' when creating a new email.
Regards, Dieter
2013 Sep 05 9:09 AM
Well Dear,
I am sorry but there is not any in Outlook to read signatures as they are not stored in the mail client but as local files at client place.
Well the data you uploaded will be RTF [Rich text format] so it would be giving you issues.
Upload it and use FM SO_RTF_TO_RAW.
Regards
2013 Sep 05 12:17 PM
Hi,
thanks, but as i have mentioned above, i only want a solution by simulate
pressing the button signature in an email:
I think there will be no way, therefore i close this thread.
Thanks again.
regards, dieter
2013 Sep 06 1:13 PM
As far as I remember (no VBA since some years now) the signature is there by default, but it was erased when body of the mail was changed (it is part of the body). So you could try to read the body (GET PROPERTY), then add a new-line and the signature to your Abap mail body and set it back in the mail ?
NB:
- you may need to have another call of display method (to be able to read signature)
- you could test, comment the property set of body, does the mail contain the default signature
Regards,
Raymond
2013 Sep 09 10:32 AM
Hi Raymond,
thanks. First i use Body, but the signature i get is not formatted like the "normal" signature.
Than i try Htmlbody and i get the signature like i need. But i get the next
Problem. My own bodytext (1. Betreff etc) has no newline, so i get my hole own bodytext in
one line. Do you have any idea?
CALL METHOD OF LR_MI 'Display'.
*
*GET PROPERTY OF LR_MI 'body' = WA_SIGN.
GET PROPERTY OF LR_MI 'Htmlbody' = WA_SIGN.
*
* Emailtext
CONCATENATE '1. Betreff'
'2. Betreff'
'3. Betreff'
INTO WA_BODY SEPARATED BY C_NEWL.
CONCATENATE WA_BODY WA_SIGN INTO WA_BODY.
*SET PROPERTY OF LR_MI 'body' = WA_BODY.
SET PROPERTY OF LR_MI 'htmlbody' = WA_BODY.
Regards, Dieter
2013 Sep 09 11:55 AM
2013 Sep 09 1:19 PM
Hi Raymond,
thanks, thats what i need. I try this:
CONCATENATE
'<p>first Line</p>'
'second Line</p>'
'third Line</p>'
INTO WA_BODY.
There is still a little problem because i get an empty line after "first line" but it's
no Problem and my knowledge is not really good in html.
Thanks again
Regards Dieter