Email by Programatically

Here is a routine from one of my programs
Code: Copy
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
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
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
Code: Copy
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
@ kickaha

I use the following
Code: Copy
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
Back
Top