Hi everyone! How can I select an image and attach the file to an email?
my code
my code
B4X:
Sub Botfoto_Click
cam.Initialize("camera",pg)
cam.SelectFromSavedPhotos(Sender, cam.TYPE_IMAGE)
End Sub
Sub Cam_Complete (Success As Boolean, Image As Bitmap, VideoPath As String)
Dim p As Phone
If Success Then
If Image.IsInitialized Then
vv.View.Visible = False
ImageView_imagen.Bitmap = Image
p.AddImageToAlbum(Image)
Else
vv.View.Visible = True
vv.LoadVideo(VideoPath, "")
Log(p.AddVideoToAlbum(VideoPath, ""))
End If
End If
End Sub
Sub enviar_mail ()
Dim subject As String = evento_electrico & evento_informacion & evento_telefonico & evento_internet & " " & Editsuministro.Text
Dim body As String = Editobs.Text
mailc.Initialize("mailc")
mailc.SetToRecipients(Array("contacto@cepralnet.com.ar"))
mailc.SetSubject(subject)
mailc.SetBody(body, True)
If capturado = True Then
mailc.AddAttachment(File.DirDocuments,??????) ''<---I don't know the name of the selected image
End If
mailc.Show(pg)
End Sub
Sub Mailc_Complete (Result As Int)
If Result = mailc.RESULT_SENT Then
Toast.ToastMessageShow("Correo enviado", 3000)
Else
Toast.ToastMessageShow("El correo no pudo ser enviado, intente nuevamente", 3000)
End If
End Sub