Dear Rick,
I created a new project and all is right, but I do not receive error emails (both on development machine and on server).
I do not uderstand what is missing.
I have the following in .ini file:
AdminEmail=...
AdminMailServer=...
AdminMailUsername=...
AdminMailPassword=...
AdminMailSSL=...
AdminSenderrorEmail=On
I tryed with different email accounts, but I do not get never emails.
Old projects send error emails, but this new one no.
Please any idea?
Thank you very much for support
I recommend you download a tool called PaperCut (download from Releases
) which is a local SMTP server that can capture emails. Set your email server to localhost
without username and password and with SSL off.
Then run your application and make it fail or do whatever else you expect to send emails. Make sure you can see the emails in the local server.
Once that works as expected, then try using your remote server.
It's possible your application is blocked by your firewall from sending emails. Make sure you application adds an exception or you explicitly enable the SMTP ports you are using.
+++ Rick ---
Dear Rick,
I cannot understand.
I have 2 applications on server: the main application and a wwAsync application, they use the same web connection classes (wwSmtp...)
The async application sends email on error:
m.oSmtp=CREATEOBJECT("wwSmtp")
WITH m.oSmtp
.nMailMode = 0
.cMailServer=m.cMailServer
.cUserName=m.cUserName
.cPassword=m.cPassword
.nTimeout=m.nTimeout
.lUseSsl=m.lUseSsl
.cSenderName=m.Mittente
.cSenderEmail=m.EmailMittente
.cRecipient=m.EmailDestinatario
.cSubject=m.Oggetto
.cMessage=m.Messaggio
.cContentType="text/html"
m.Esito = .SendMail()
ENDWITH
I get error emails.
The main application do not sends admin error emails, I tried with different email accounts (with SSL and without SSL), but it dos not send never admin error emails.
This is .ini file:
[Main]
TempFilePath=C:\WCONNECT\TEMP\RENIERI\
Template=WC_
TimerInterval=200
LogToFile=Off
ShowStatus=Off
ShowServerForm=On
SaveRequestFiles=Off
UseMTS=Off
AdminEmail=myemail@gmail.com
AdminMailServer=smtp.gmail.com:587
AdminMailUsername=testemail@gmail.com
AdminMailPassword=2019
AdminMailUseSsl=On
AdminSenderrorEmail=On
Debugmode=Off
Showrequestdata=Off
Unattendedcommode=Off
Memusage=8176
Pageparsemode=3
Scriptmode=2
Please, what could prevent the sending of admin error emails?
The only difference is nMailMode property.
Many thanks again
Easiest way to check is set up a sample process class request and send an Admin Email from there.
FUNCTION TestEmail
lcError = ""
IF (!Server.SendAdminEmail("Test Message", "Message Content", Server.oConfig.cAdminEmail, "Administrator", .f., .f., @lcError))
THIS.ErrorMsg("Failed to send test message","Test message failed <hr>" + lcError)
ELSE
THIS.StandardPage("Email Sent","Test Email Sent")
ENDIF
ENDFUNC
I suspect nMailMode is the only difference, because I can send email by forcing nMailMode=0, while I see nMailMode=2 in standard send error email procedure.
It could be any other reason?
You have AdminMailSsl=on
which means you have to use mode 0.
+++ Rick ---
Solved.
I have WC 6.05
In wwServer.prg I added in DEFINE CLASS wwServerConfig AS WWC_WWCONFIG
lAdminMailSSL=.F.
The lack of this initialization prevented to read AdminMailSSL parameter in .ini file.
In wwProcess.SendErrorEmail I added:
* loIp.nMailMode = 2
loIp.nMailMode = 0
loIP.lUseSsl = this.oServer.oConfig.lAdminMailSSL
I got no more admin error emails when I changed on email account with SSL=on (gmail). AdminMailSSL parameter in .ini file did not work. Now I get admin errors also on email account with SSL=on