B4J Question (SLOVED)SMTP send message not returning true

alienhunter

Active Member
Licensed User
Longtime User
Hi ,
I looks like this does not return true , the Emial is send but this does not return true
does anyone has this problem ?
thanks AH




B4X:
Sub smtpx_MessageSent(Success As Boolean)
 
   If Success=True Then
    End If

   If Success=False Then
       msgb.Show("Email failed to send " & CRLF & LastException , "Email")
   End If

End Sub


or

B4X:
                Wait For smptx_MessageSent(Success As Boolean)
                If Success  Then
                    fx.Msgbox(perpmainsheet," THE EMIAL HAS BEEN SENT ","EMIAL SENT")
                Else
                    fx.Msgbox(perpmainsheet,"EMIAL ERROR " & CRLF & LastException ,"EMIAL NOT SENT")
                End If
 
Last edited:

alienhunter

Active Member
Licensed User
Longtime User
What is the output of Log(LastException)?
Hi
thanks for the answer

maybe i wrote it wrong the
If Success Then fx.Msgbox(perpmainsheet," THE EMIAL HAS BEEN SENT ","EMIAL SENT") does not return true

The false/error works if this occurs
strange thing
AH
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
Change your code to:
B4X:
Wait For smptx_MessageSent(Success As Boolean)
Dim xui As XUI
xui.MsgboxAsync(Success, "Test")

Does it show?


thanks
nope
beats me why it does not show up
here is the whole if and then thing an the log
thanks AH

B4X:
Dim xui As XUI
    If countresult >0 Then
        Dim res As Int =fx.Msgbox2(perpmainsheet,"SEND EMIAL TO PURCHASING ?","EMAIL SENDING ","YES","","MO",fx.MSGBOX_CONFIRMATION)
        If res=fx.DialogResponse.POSITIVE Then
            savetomaindb
            Try
                smtpx.To.Add("a.com")
                smtpx.Sender ="s.com"
                smtpx.subject = " STOCKORDER EMIAL" & " for Job " &  stockjobnr.Text.Trim & "_" & stockpartname.Text.Trim
                smtpx.HtmlBody=True
                smtpx.body = sb
                smtpx.Send
                Log("it went thru") see log (capture.png)
                Wait For smptx_MessageSent(Success As Boolean)
                xui.MsgboxAsync(Success, "Test")
              
            Catch
                fx.Msgbox(perpmainsheet,"ERROR SEND EMIAL" & CRLF & LastException,"EMIAL SETTING")
            End Try
          
            Else
            fx.Msgbox(perpmainsheet,"NO EMAIL SENT PLEASE MAKE SURE THE STOCK IS AVAILABLE","EMIAL NOT SENT")
          
        End If
      
    Else
        Log("no email")
      
    End If
 

Attachments

  • Capture.PNG
    Capture.PNG
    1.8 KB · Views: 161
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
Where is smtpx initialized? Post the code without the credentials.

Hi
this is init in appstart and the jnet version is 1.77
and thank you very much for your help

B4X:
Sub

AppStart(modexx As Int , idx As Int )

    perpmainsheet.Initialize("perpmainsheet",-1,-1)
    perpmainsheet.RootPane.LoadLayout("prep_stock_order_sheet")
    perpmainsheet.SetFormStyle("DECORATED")
    perpmainsheet.Resizable=False
    perpmainsheet.Title="PREP-MAIN-SHEET"
    'perpmainsheet.SetOwner(Main.MainForm)
    perpmainsheet.Show
   

    modex=modexx
    parxx=idx
    modes
   
   
    msqlstockdb.InitializeAsync("mysqldb","com.mysql.jdbc.Driver","jdbc:mysql:" & Main.links & Main.datab,Main.userr,Main.passw)
   
    smtpx.Initialize( "exchangeserver.com",25, "","","smtpx")
    smtpx.UseSSL = False

   
End Sub
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
The signature of AppStart is wrong.

hmmm
in a smiple way nothing else
i tried
smtpx.Initialize("",25, "","","smtpx")
Wait For smptx_MessageSent(Success As Boolean)
no message
or
smtpx.Initialize("",25, "","","smptxt")
Wait For smptxt_MessageSent(Success As Boolean)
no message
but email goes thru

Capture.PNG
 
Last edited:
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
The code in the screenshot is not the same as the code you posted.

Please upload the project.

hi
here it is
using jdk-8u192 , i tried other versions too but no luck
thanks a lot to take your time for something simple as this but i have to make sure the emial is sent
Alfred
 

Attachments

  • project.zip
    993 bytes · Views: 196
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
1. You haven't implemented it as I suggested in post #6. Your program will not show anything if Success is false.

2. The event name was set to smtpx

This means that it should be:
B4X:
Wait For smtpx_MessageSent(Success As Boolean)
You wrote:

B4X:
Wait For smptx_MessageSent(Success As Boolean)
 
Upvote 0

alienhunter

Active Member
Licensed User
Longtime User
i
1. You haven't implemented it as I suggested in post #6. Your program will not show anything if Success is false.

2. The event name was set to smtpx

This means that it should be:
B4X:
Wait For smtpx_MessageSent(Success As Boolean)
You wrote:

B4X:
Wait For smptx_MessageSent(Success As Boolean)

My apologies it is working now, sometimes I do not see the trees in the forest
:oops:


Capture.PNG
 
Upvote 0
Top