Email Script

Hi,

I have an email script that appears to be sending the email, but, I am not getting it!?!

I have msgbox’d a few places to make sure its not bombing out half way through and its not.

Does anyone have any ideas as to what might be wrong?

Thanks

F1H

Code :

Sub HTMLEmailInspector(session As NotesSession, db As NotesDatabase, doc As NotesDocument)

Msgbox "Emailing Inspector"

Dim docMail As NotesDocument

Dim body As NotesMimeEntity

Dim child As NotesMimeEntity

Dim stream As NotesStream

Dim intPosofNsf As Integer

Dim strPath As String

Dim strURL As String



On Error Goto errorHandling



session.ConvertMime = False

Set docMail = New NotesDocument( db )     

Set stream = session.CreateStream



intPosofNsf = Instr(doc.Path_Info(0), ".nsf") + 3

strPath = Left$(doc.Path_Info(0), intPosofNsf)

strURL = "http://" & doc.Server_Name(0) & strPath & "/RIRAll/" & doc.Universalid & "?opendocument"



docMail.Form = "Memo"    

docMail.SendTo = doc.InspectAssigned(0)

Msgbox doc.InspectAssigned(0)

docMail.Subject = "Action: " & doc.JobNum(0) & " RIR " & doc.RIRNum(0) & " Raised. " & doc.StoredDesc(0)

Set body = docMail.CreateMIMEEntity

Set child = body.CreateChildEntity



Call stream.WriteText(|<b>You have been assigned RIR | & doc.RIRNum(0) & "<br><br>" & _

"Order No: " & doc.JobNum(0) & "<br>" & _

"Line No: " & doc.ItemNum(0) & "<br>" & _

"Line Description: " & doc.StoredDesc(0) & "<br>" & _

"Description: " & doc.GetItemValue("description")(0) & "<br><br>"  & _

"You can view the RIR by clicking on the following url." & "<br>" & _

|<a href="| & strURL & |">| & strURL & "</a><br><br>" & _

"<b><u><font size='-1'>Additional Detail</u></b>" & "<br>" & _

"Job No: " & doc.JobOrdNo(0) & "<br>" & _

"Job Item No: " & doc.JobItemNo(0) & "<br>" & _

"Packing Note No: " & doc.PackNote(0) & "<br>" & _

"Date Ordered: " & doc.OrderDate(0) & "<br>" & _

"Location: " & doc.location(0) & "<br>" & _

"Date Received: " & doc.TableDate(0) & "<br>" & _

"Quantity: " & doc.Qty(0) & "<br>" & _

"Originator: " & doc.Originator(0) & "<br>" & _

"Date: " & doc.OrigDate(0) & "<br>")

Call child.SetContentFromText(stream, "text/html", ENC_QUOTED_PRINTABLE)

Call stream.Truncate

Call docMail.Save(True, False)

Msgbox "Sending..."

Call docMail.Send(False)	

Call docMail.Remove(True)



session.ConvertMime = True



Exit Sub

errorHandling:

Print "HTMLEmaiInspector Error Reports:"     

Print Err & " " & Error$

Print "Error Generator Failed <br>"	

Print doc.JobNum(0) & " RIR Raised. " & doc.StoredDesc(0) & "<br>"

Print "RIR No: " & doc.RIRNum(0)  & "<br>"

Exit Sub

End Sub

Subject: Email Script…

Fixed.

The account I was using was a developer only account - had no mail account - it is now forwarding the mail to my account.

Silly me.

:o)