Problem with AppendRTItem

I have a richtext field in the form it works fine when the email is sent internally however, when I sent to an external address it is not working properly.

Code I am using:–

Dim session As New NotesSession

Dim db As NotesDatabase

Dim maildoc As NotesDocument

'Dim mailitem As NotesRichTextItem

Dim mailitem As Variant

Dim sys As NotesDocument

Dim BodyItem As Variant

Dim person As NotesName

Dim manager As notesname

Dim sendToItem As NotesItem

Dim j As Integer

Dim m As Integer

Dim item As notesitem

Dim item1 As notesitem

'Dim rtitem As Variant

Dim rtitem As NotesRichTextItem



On Error Goto ErrorHandler     

Ret1= 0



Set db = session.CurrentDatabase

Set maildoc = New NotesDocument(db)     'Create a mail document

Set mailitem = maildoc.createrichtextitem("Body")    'Produce a rich text body field on the mail

Set sys = db.GetProfileDocument( "proEmail" )   'Grab handle to email configuration

maildoc.form = "Memo"

maildoc.Logo = sys.Logo(0)

maildoc.Principal = sys.Principal(0)



Set person = New NotesName(doc.RequestorName(0))     

Set manager=New NotesName(doc.LineManager(0))

'Msgbox"replyto" &sys.Mailreply(0)

'Msgbox"sendto" &sys.MailAddr(0)

maildoc.FromPhone = ""

maildoc.ReplyTo = "satyaveni.g@tcs.com"

'Msgbox"repkyto" & maildoc.ReplyTo(0)

'maildoc.ReplyTo=sys.MailReply(0)

maildoc.CopyTo = ""



maildoc.subject = sys.ITRTeam(0)

Set BodyItem = sys.GetFirstItem( "rtfTeam" )   

Set sendToItem = New NotesItem(maildoc, "SendTo", "Satyaveni Garalanka/Pearl/UK/AMPDev@AMPDev")

Call sendToItem.AppendToTextList("")



Call BodyItem.CopyItemToDocument(maildoc, "Body")    

Set rtitem=doc.GetFirstItem("RequestRationale")



With mailitem

	.addNewLine 2

	.appendtext "REQUESTED BY:" & Chr(9) & person.Common

	.addnewline 1

	.appendtext "FORM TYPE:" & Chr(9) & FormType(doc)

	.addnewLine 1

	.appendtext "REFERENCE:" & Chr(9) & doc.ITR_Reference(0)

	.addnewline 1

	.appendtext "BUSINESS UNIT:" & Chr(9) & doc.Function(0)

	.addnewline 1

	.appendtext "LOCATION:" & Chr(9) & doc.Location(0)

	.addnewline 1

	.appendtext "TELEPHONE:" & Chr(9)& doc.RequestorTelephone(0)

	.addnewline 1

	.appendtext "LINE MANAGER:" & Chr(9) & manager.common

	.addnewline 1

	.appendtext "DATE REQUIRED:" & Chr(9) & doc.dtRequired(0)

	.addnewline 1

	.appendtext "REQUEST RATIONALE: " & Chr(13) 

	.AppendRTItem(rtitem)

.addnewline 1

If(FormType(doc)=“Leavers Form”) Then

		.appendtext "SERVICE RECEIVER(1):"

		.addnewline 1

		Dim Lperson As notesname

		Set Lperson = New NotesName(doc.Receiver_1(0))     

		.appendtext "NAME:" & Chr(9) & Chr(9) &  Chr(9) & Lperson.common

		.addnewline 1

		.appendtext "DESK:" & Chr(9) & Chr(9) &  Chr(9) &doc.DeskNo_1(0)

		.addnewline 1

		.appendtext "TELEPHONE:" & Chr(9)  &doc.Telephone_1(0)

		.addnewline 1

		.appendtext "USERID TO COPY:" & Chr(9)  &doc.UserID_1(0)

		.addnewline 1

		.appendtext "LOCATION:" & Chr(9)  &doc.Location_1(0)

		.addnewline 1

		m=0

		Set item=doc.GetFirstItem("StandardItem_1a")

		Forall v In item.values

			.appendText "ACCESS ITEM:" & (m+1)

			.addnewline 1

			.appendtext "ITEM:" & Chr(9) & Chr(9) &  Chr(9)  & v		

			m=m+1

			.addnewline 1

		End Forall

FYI

The format of the email when I used external address:-

The following request has been assigned to Mainframe Security Admin Team.

REQUESTED BY: Satyaveni Garalanka

FORM TYPE: Leavers Form

REFERENCE: UKDEV03/47

BUSINESS UNIT: Change Delivery

LOCATION: Chennai - India

TELEPHONE: 1212

LINE MANAGER: Sathish Sheshachala

DATE REQUIRED: 11/05/2008

REQUEST RATIONALE: Please remove the following userids from the NPI

mainframe only - their

Pearlidsmustremain:DELLARHUTCHIDFIDLER,DGREENW,ELLISM, JBELCHE,JJEFFS,

The format of the email when I used Internal address:-

The following request has been assigned to Mainframe Security Admin Team.

REQUESTED BY: Satyaveni Garalanka

FORM TYPE: Leavers Form

REFERENCE: UKDEV03/51

BUSINESS UNIT: CSC

LOCATION: Lower Computer Block

TELEPHONE: 121212

LINE MANAGER: Sathish Sheshachala

DATE REQUIRED: 12/05/2008

REQUEST RATIONALE:

Please remove the following userids from the NPI mainframe only - their Pearlidsmustremain:DELLARHUTCHIDFIDLER,DGREENW,ELLISM, JBELCHE,JJEFFS,

JLAMPET,MCROSSM,NLAGERM,

SFRETW1,

SIRELAN,

SPERICH,

TFOOT01

TGOODAL

Also, can you please remove the following userid from both the Pearl and NPI mainframe CS07632.

Can you please reinstate access for Caroline Hayvice who is

returning from maternity leave next week. Her userid is HAYVCA 





Citrix

Pearl Mainframe

West Mainframe (pwescics)

Work Control System (WCS) 

Wallace

GPC Cardiff

CMS (PACE) - User Group = PAC-41G.Please use HILLDA as a 

templateSERVICE RECEIVER(1):

NAME: Satyaveni Garalanka

DESK: 1

TELEPHONE: 1

USERID TO COPY: 1

LOCATION: Chennai - India

ACCESS ITEM:1

ITEM:

OTHER ACCESS INFORMATION:

DATE SUBMITED:

STATUS: Assigned

LAST ACTION: Request moved to Assigned Status by Satyaveni Garalanka

PENDING ACTION :Assigned IT Team(s)

COMMENTS:

Thank You

Can you please help me out regarding this.

Subject: Problem with AppendRTItem

Odd.

First thing I would try after the .AppendRTItem(rtitem) is do a save to see if that makes any difference.

My next GUESS is you’ve line of text is running past 72 characters and is being truncated vs wrapping. Not sure what setting maybe be used to tell the system to automatically wrap the text vs truncate.

Subject: RE: Problem with AppendRTItem

try calling Update method.