Sub Activity_Create(FirstTime As Boolean)
activity.AddMenuItem2("Mail Author","mailme",LoadBitmap(File.DirAssets,"mail.png"))
[COLOR="Green"]' here goes more code so i just deleted[/COLOR]
End Sub
[COLOR="Green"]' And then just put this:[/COLOR]
Sub mailme_click
Dim mailapp As Email
mailapp.To.Add("[email protected]")
mailapp.Subject = "From my app"
StartActivity(mailapp.GetIntent)
End Sub
Try with this:
This will add menu button - Mail Me
B4X:Sub Activity_Create(FirstTime As Boolean) activity.AddMenuItem2("Mail Author","mailme",LoadBitmap(File.DirAssets,"mail.png")) [COLOR="Green"]' here goes more code so i just deleted[/COLOR] End Sub [COLOR="Green"]' And then just put this:[/COLOR] Sub mailme_click Dim mailapp As Email mailapp.To.Add("[email protected]") mailapp.Subject = "From my app" StartActivity(mailapp.GetIntent) End Sub
Use Phone library
Just type mailapp and you will see a list to add:
Been searching for a way to open the devices default email app to send an email. Will also need the To, Subject, and message to populate the opened email. Can't figure out how to so this. Any advice?
Sent from my DROIDX
Sub SendMail(SendTo As String, SendBody As String, SendSub As String, SendAtt As String)
Dim ei As Email
ei.To.Add(Trim(SendTO))
ei.Body = SendBody
ei.Subject = Trim(SendSub)
If SendAtt <> "" Then
ei.Attachments.Add(SendAtt)
End If
StartActivity(ei.GetIntent)
End Sub
I use this code in several APPs I have written and it works well. Place this code in your app and call it with your text or variables. Example:
SendMail("[email protected]", "This is my email message here", "My Email Subject", "listoffriends.txt")
B4X:Sub SendMail(SendTo As String, SendBody As String, SendSub As String, SendAtt As String) Dim ei As Email ei.To.Add(Trim(SendTO)) ei.Body = SendBody ei.Subject = Trim(SendSub) If SendAtt <> "" Then ei.Attachments.Add(SendAtt) End If StartActivity(ei.GetIntent) End Sub
Hope this helps,
Margret
Is there a library I need to include? It's not recognizing Trim when I compile
Sub SendMail(SendTo As String, SendBody As String, SendSub As String, SendAtt As String)
Dim ei As Email
ei.To.Add(Trim(SendTO))
ei.Body = SendBody
ei.Subject = Trim(SendSub)
If SendAtt <> "" Then
ei.Attachments.Add(SendAtt)
End If
StartActivity(ei.GetIntent)
End Sub
s.SendMail("[email protected]", "This is my email message here", "My Email Subject", "listoffriends.txt")
B4X:Sub SendMail(SendTo As String, SendBody As String, SendSub As String, SendAtt As String) Dim ei As Email ei.To.Add(Trim(SendTO)) ei.Body = SendBody ei.Subject = Trim(SendSub) If SendAtt <> "" Then ei.Attachments.Add(SendAtt) End If StartActivity(ei.GetIntent) End Sub
I've been using this code for years but I need to change out-going emails from HTML to plain text.
Does anyone know how to use IsBodyHTML with this code or some other workaround?
The Net library@nfordbscndrd what library is that as I've not seen IsBodyHTML in either Email in the phone library or SMTP in the Net library?
SMTP.HtmlBody = True