I am sure I am doing something silly, but I just cannot figure out what is going on with this code. It works fine in B4a, but in B4i I only receive the first email, not the Order Confirmation message.
(The user name and password were changed to protect the innocent.)
(The user name and password were changed to protect the innocent.)
B4X:
Sub PlaceOrder
Dim SMTP1 As SMTP
Dim MsgBody As String
Dim fPhone As String
Dim tPrice As Double
Dim tQty As Int
Dim tTotal As Double
Dim fi As String
Dim inList As List
fi = "WVHCart.txt"
inList.Initialize
fPhone = InstallPhone
SMTP1.Initialize("smtp.gmail.com", 465, "[email protected]", "Password", "SMTP")
SMTP1.UseSSL = True
' SMTP1.To.Add("[email protected]")
SMTP1.To.Add("[email protected]")
' SMTP1.BCC.Add("[email protected]")
SMTP1.Subject = "Spot Hops: INCOMING!"
MsgBody = "The following user has ordered product on their Apple device! " & LF & LF
MsgBody = MsgBody & "User Email: " & InstallEMail & LF
MsgBody = MsgBody & "User Phone: " & fPhone & LF
inList = File.ReadList(File.DirDocuments,fi)
tTotal = 0
For i = 0 To inList.Size - 1 Step 4
MsgBody = MsgBody & "-------------------------------------" & LF
rLine = inList.Get(i+1)
MsgBody = MsgBody & "Item: " & rLine & LF
rLine = inList.Get(i+2)
MsgBody = MsgBody & "Price: $" & rLine & LF
tPrice = rLine
rLine = inList.Get(i+3)
MsgBody = MsgBody & "Qty: " & rLine & LF
tQty = rLine
tTotal = tTotal + (tPrice * tQty)
Next
Dim st As String = NumberFormat2(ShipTot,1, 2, 2, False)
MsgBody = MsgBody & LF & "Shipping: TBD"
Dim st As String = NumberFormat2(tTotal,1, 2, 2, False)
MsgBody = MsgBody & LF & LF & "Total: $" & st
MsgBody=MsgBody & LF & LF & "Customer Zip Code: " & etZipCode.Text
SMTP1.Body = MsgBody
SMTP1.Send
'--------------------------------------------------------------------------------------------------------
SMTP1.Initialize("smtp.gmail.com", 465, "[email protected]", "Password", "SMTP")
SMTP1.UseSSL = True
SMTP1.To.add(InstallEMail)
SMTP1.Subject = "Willamette Valley Hops Order Confirmation"
MsgBody = "Thank you for your order!" & LF
MsgBody = MsgBody & "A representative will contact you shortly to gather your shipping and billing information." & LF & LF
MsgBody = MsgBody & "Cart Detail" & LF
inList.Clear
inList = File.ReadList(File.DirDocuments,fi)
For i = 0 To inList.Size - 1 Step 4
rLine = inList.Get(i+1)
MsgBody = MsgBody & "Item: " & rLine & LF
rLine = inList.Get(i+2)
MsgBody = MsgBody & "Price: $" & rLine & LF
tPrice = rLine
rLine = inList.Get(i+3)
MsgBody = MsgBody & "Qty: " & rLine & LF
tQty = rLine
MsgBody = MsgBody & "__________________________________________" & LF
tTotal = tTotal + (tPrice * tQty)
Next
Dim st As String = NumberFormat2(ShipTot,1, 2, 2, False)
' MsgBody = MsgBody & LF & "Shipping: $" & st
MsgBody = MsgBody & LF & "Shipping: TBD"
'tTotal = tTotal + ShipTot
Dim st As String = NumberFormat2(tTotal,1, 2, 2, False)
MsgBody = MsgBody & LF & LF & "Total: $" & st
MsgBody = MsgBody & LF
MsgBody = MsgBody & "We look forward to talking to you!" & LF & LF
MsgBody = MsgBody & "Willamette Valley Hops" & LF
MsgBody = MsgBody & "PO Box 276" & LF
MsgBody = MsgBody & "St. Paul, Oregon 97137" & LF & LF
MsgBody = MsgBody & "503.633.4677" & LF
MsgBody = MsgBody & "[email protected]" & LF
SMTP1.Body = MsgBody
SMTP1.Send
File.Delete(File.DirDocuments,fi)
NavControl.RemoveCurrentPage
NavControl.RemoveCurrentPage
hd.ToastMessageShow("Order Submitted. Thank you!",True)
End Sub