Hello, all i have an issue, i need to attach a csv file to an e-mail, i've searched the forums to efficiently do this, but none of the solutions found work for me.
the solutions i've tried so far, either sends the e-mail but without the attachment, or gives me an error.
this solution works but only if i attach a file with the .dat extension
I tried attaching different files but only the file with the .dat extension goes through
for any other files i get a notification saying that the attachment could not be attached.
Dim Message As Email
Dim intent1 As Intent
Message.To.Add("[email protected]")
Message.Subject = Main.orderfor
Message.Body = Order_Items.sb1.ToString
Message.Attachments.Initialize
Message.Attachments.Add(File.Combine(File.DirDefaultExternal, "keys.txt"))
'ntent1 = Message.GetIntent
'ntent1.SetType("text/plain")
StartActivity(intent1)
'
I tried this other code, but when the gmail app opens it forecloses giving me an error
Public Sub SendMailnow
Dim Intent1 As Intent
Uri="file://"&File.Combine(File.DirDefaultExternal, "keys.txt")
Intent1.Initialize(Intent1.ACTION_SEND,"")
Intent1.PutExtra("android.intent.extra.SUBJECT","file.zip")
Intent1.PutExtra("android.intent.extra.STREAM",Uri )
Intent1.SetType("application/zip")
Intent1.PutExtra("android.intent.extra.TEXT","Message Text")
StartActivity(Intent1)
End Sub
I personally like this code, but i don't know how to add the attachment in this code
Sub MailTo(StrAddress As String, StrSubject As String, StrBody As String)
Dim StrMethod As String = "Sub StartEmailClient(StrSubject As String, StrBody As String)"
Try
Dim StrUri As String
StrUri = "mailto:" & StrAddress & "?subject=" & StrSubject & "&body=" & StrBody
'StrUri = "file://"&File.Combine(File.DirDefaultExternal, "templist.dat")
Dim Intent As Intent
Intent.Initialize(Intent.ACTION_VIEW, StrUri)
Log(Intent.ExtrasToString)
StartActivity(Intent)
Catch
LogColor(LastException & " - " & StrMethod, Colors.Magenta)
End Try
End Sub
this works fine but i need to attach a csv file to the e-mail before sending it.
Please any and all help will be greatly appreciated.
I need to find a solution for this quick
I cannot use smtp library or net library because my customer wants it done this way for now and since smtp library requires the users to enter their user name and password, i don't think he likes that very much.
Thanks All
Walter