I don't know if this was ever resolved, but I have a similar problem. I am trying to email an attachment based on the code in the example but whilst the email is working the attachment is not. I am probably doing something very silly, but can anyone see what is wrong with this code.
Many thanks
Charles
Sub Activity_Create(FirstTime As Boolean)
'Activity.LoadLayout("Mailtest")
If File.ExternalWritable = False Then
Msgbox("Cannot write on storage card.", "")
Return
End If
SaveStringExample
SendMail
End Sub
Sub SaveStringExample
File.WriteString(File.DirRootExternal, "Report.txt", _
"Pool hall volume = 7164 Air Temp = 29.0 Air changes/hr = 1.15" & CRLF & "Annual Heat Loss = 473578.38 kWh")
End Sub
Sub SendMail
Dim Message As Email
Dim savedir, savefile , receiver, subject, body As String
receiver = "xyz@gmail.com"
subject = "Test Report - 3 June 2011"
body = "Pool hall volume = 7164 Air Temp = 29.0 Air changes/hr = 1.15 Annual Heat Loss = 473578.38 kWh JUST A DEMO!"
savefile= "Report.txt"
savedir = File.DirRootExternal
Message.To.Add(receiver) 'Email address
Message.Subject = subject 'Email subject
Message.body = body 'Email main text
If File.Exists(File.DirRootExternal,"Report.txt") Then Msgbox ("File found", "Working")
Message.Attachments.Add(File.Combine(savedir,savefile))
StartActivity(Message.GetIntent)
End Sub