Android Question b4a SMTP using smtp.office365.com

ropla

Member
Licensed User
Longtime User
i All,

I am trying to send mails using smtp.office365.com.
I get an error all the time

When use gmail in the same way it works.
Does anyone have a tip for me?

Gr. Ronald
 

RobM

Member
Licensed User
Longtime User
I too have issues sending to Office 365 server, can send with Gmail and Hotmail ok.

I always get this error,
java.lang.RuntimeException: Empty writer returned: 503 5.5.2 Send hello first

Have confirmed port number etc are correct.

Thanks,


B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim m As SMTP
End Sub
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Dim mypass As String ="mypass"
Dim mymail As String ="mymail"
Private Button1 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
m.Initialize("smtp.office365.com",587,mymail,mypass,"mail") 'office 365 not working
'm.Initialize("smtp.live.com",587,mymail,mypas,"mail") 'hotmail this works
m.StartTLSMode=True
' have tried all below, no change
'm.UseSSL=True
'm.AuthMethod=m.AUTH_CRAM_MD5
'm.AuthMethod=m.AUTH_LOGIN
'm.AuthMethod=m.AUTH_PLAIN
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub mail_MessageSent(Success As Boolean)
If Success Then
ToastMessageShow("Message sent successfully", True)
Log("Mail sent ok")
Else
ToastMessageShow(LastException.Message, True)
Log(LastException.Message)
End If
End Sub
Sub sendmail
m.To.add("[email protected]") '
m.Body=("Test SMTP")
m.Subject=("Test SMTP")
m.send
Log("Mail sent?")
End Sub
Sub Button1_Click
sendmail
End Sub

Edit: code should have read to read smtp.office365.com
 
Last edited:
Upvote 0

lemonisdead

Well-Known Member
Licensed User
Longtime User
I don't know if already done so I am sending the information to Erel
 
Upvote 0

ropla

Member
Licensed User
Longtime User
Hi guys,

I am sorry I did not respond. Having vacation was the reason.
Read all of it , and .........................

IT WORKS!!!!!

Thank you all guys fot the efford

Greets Ronald
 
Upvote 0
Top