Hallo
I want to sent an email with an attachment from my app to my email account each time a certain sub is called by the user. The user itself does not need to recognised that the mail is being sent. Below are copies and extracts from the relevant subs.
The problem is now that with the specified attachment the email is not being sent, or at least I am not receiving anything. As soon as i try to sent the mail with the same settings without the attachment, it works.
Does someone have an idea what I am doing wrong?
Thanks again.
Regards
René
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
Dim DBFileName As String : DBFileName = "estartliste.sqlite"
Dim DBFileDir As String : DBFileDir = File.DirRootExternal & "/eStartliste"
Dim MyMail As SMTP
....
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If FirstTime Then
' initialize the database
If File.Exists(DBFileDir, DBFileName) = False Then
File.MakeDir(File.DirRootExternal, "eStartliste")
File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName)
End If
SQL1.Initialize(DBFileDir, DBFileName, True)
'Settings screen
CreatePreferenceScreen
If manager.GetAll.Size = 0 Then
SetDefaults
End If
'Email functionality through GMail
MyMail.Initialize("smtp.gmail.com", 465, "[email protected]", "Flight$1", "MyGmailSMTP")
MyMail.UseSSL = True
End If
....
Sub UploadFluege_Click
Dim JobUploadFluege As HttpJob
Dim jsonpost, q, s As String
Dim myJSON As JSONGenerator
Dim mp As Map
q = "SELECT * FROM starts Where Upload = 0 " & _
"AND Pilot1 <> '(0) Auswahl' " & _
"AND Start <> '00:00' " & _
"AND Landung <> '00:00'"
myJSON.Initialize(MyExecuteJSON_Upload(SQL1, q, Null, 0, _
Array As String(DB_INTEGER, DB_DATETIME, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_BOOL, DB_INTEGER, DB_INTEGER)))
s = myJSON.ToPrettyString(4)
'Msgbox(s, "")
ProgressDialogShow("Upload Flüge")
jsonpost="postjson=" & myJSON.ToString
JobUploadFluege.Initialize("JobUploadFluege", Me)
JobUploadFluege.PostString(urlUploadFluege, jsonpost)
Log("Email")
DateTime.DateFormat = "yyyy.MM.dd"
MyMail.To.Add("[email protected]")
MyMail.Subject = "eStartliste Database"
MyMail.Body = DateTime.Date(DateTime.Now)
MyMail.AddAttachment(DBFileDir, DBFileName)
MyMail.Send
End Sub
I want to sent an email with an attachment from my app to my email account each time a certain sub is called by the user. The user itself does not need to recognised that the mail is being sent. Below are copies and extracts from the relevant subs.
The problem is now that with the specified attachment the email is not being sent, or at least I am not receiving anything. As soon as i try to sent the mail with the same settings without the attachment, it works.
Does someone have an idea what I am doing wrong?
Thanks again.
Regards
René
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
Dim DBFileName As String : DBFileName = "estartliste.sqlite"
Dim DBFileDir As String : DBFileDir = File.DirRootExternal & "/eStartliste"
Dim MyMail As SMTP
....
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("Layout1")
If FirstTime Then
' initialize the database
If File.Exists(DBFileDir, DBFileName) = False Then
File.MakeDir(File.DirRootExternal, "eStartliste")
File.Copy(File.DirAssets, DBFileName, DBFileDir, DBFileName)
End If
SQL1.Initialize(DBFileDir, DBFileName, True)
'Settings screen
CreatePreferenceScreen
If manager.GetAll.Size = 0 Then
SetDefaults
End If
'Email functionality through GMail
MyMail.Initialize("smtp.gmail.com", 465, "[email protected]", "Flight$1", "MyGmailSMTP")
MyMail.UseSSL = True
End If
....
Sub UploadFluege_Click
Dim JobUploadFluege As HttpJob
Dim jsonpost, q, s As String
Dim myJSON As JSONGenerator
Dim mp As Map
q = "SELECT * FROM starts Where Upload = 0 " & _
"AND Pilot1 <> '(0) Auswahl' " & _
"AND Start <> '00:00' " & _
"AND Landung <> '00:00'"
myJSON.Initialize(MyExecuteJSON_Upload(SQL1, q, Null, 0, _
Array As String(DB_INTEGER, DB_DATETIME, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, DB_VARCHAR, _
DB_BOOL, DB_INTEGER, DB_INTEGER)))
s = myJSON.ToPrettyString(4)
'Msgbox(s, "")
ProgressDialogShow("Upload Flüge")
jsonpost="postjson=" & myJSON.ToString
JobUploadFluege.Initialize("JobUploadFluege", Me)
JobUploadFluege.PostString(urlUploadFluege, jsonpost)
Log("Email")
DateTime.DateFormat = "yyyy.MM.dd"
MyMail.To.Add("[email protected]")
MyMail.Subject = "eStartliste Database"
MyMail.Body = DateTime.Date(DateTime.Now)
MyMail.AddAttachment(DBFileDir, DBFileName)
MyMail.Send
End Sub