Email by Programatically

kickaha

Well-Known Member
Licensed User
Longtime User
Here is a routine from one of my programs
B4X:
Sub ButtonSaveSendMail_Click
   Dim Message As Email
   Dim savedir, savefile As String   
   savefile= EditTextSaveFilename.Text & ".csv"
   savedir = File.DirRootExternal & "/AndyPad"

   Message.To.Add(EditTextSaveAddress.Text) 'Email address
   Message.body = EditTextSaveEmailBody.Text 'Email main text 
   Message.Attachments.Add(File.Combine(savedir, savefile))' attach a file to the email
   StartActivity(Message.GetIntent) 

End Sub
Hope that gives you a start on it.
 
Upvote 0

NJDude

Expert
Licensed User
Longtime User
Speaking of emailing programatically, it seems Android depends on a email client installed on the device?, I'm asking this because I'd like to write a sample email client and it doesn't work, the code you posted doesn't work on my HTC EVO; I have found also another sample code which does work on mine but opens the email client <?>

Has anyone written a B4A email client by any chance?
 
Last edited:
Upvote 0

ManuelFG

Member
Licensed User
Longtime User
How send automatically email without push a button

I need help about how send automatically email without push a button. This program work but it need push a button.
is it posible to do by program?
Thank
Manuel
:sign0085:



Here is a routine from one of my programs
B4X:
Sub ButtonSaveSendMail_Click
   Dim Message As Email
   Dim savedir, savefile As String   
   savefile= EditTextSaveFilename.Text & ".csv"
   savedir = File.DirRootExternal & "/AndyPad"

   Message.To.Add(EditTextSaveAddress.Text) 'Email address
   Message.body = EditTextSaveEmailBody.Text 'Email main text 
   Message.Attachments.Add(File.Combine(savedir, savefile))' attach a file to the email
   StartActivity(Message.GetIntent) 

End Sub
Hope that gives you a start on it.
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
@ kickaha

I use the following
B4X:
Dim SMTP As SMTP
Dim server, emailname, password, protocol, Msg As String
Dim port As Int

.....
....
SMTP.Initialize(server, port, emailname, password, protocol)
SMTP.UseSSL=True

    SMTP.To.Add(emailname)
    SMTP.Subject = "test"
    SMTP.Body = Msg
    SMTP.Send

What is the benefit of one over the other.
Also what happens if there is no internet connection at the time of aactivaton? does the email get save until a connection becomes available?

Thanks
Joe
 
Upvote 0

Itsoftware

New Member
Hi! I'm tryin to send an email notification, but here! ???

What should get in the activity named: "Message.Getintent" ?

thanks in advance.
 
Upvote 0
Top