Sending emails from a site or an application in the CLOUD

Can I send an email from a site, an application or a webservice deployed on a CLOUD platform?


Yes.

An SMTP server is available on each platform for PC SOFT applications. It allows you to send emails from your sites, applications and webservices ; via the Email functions of WLanguage. This server is accessible via the localhost address without having to specify any user or password.


You can also use your usual SMTP server (Orange, Google ...) in order to store the outgoing messages. The standard ports 25, 465, 587 are opened by default on the platform.


For example, the code below is used to send an email from a PCSCLOUD platform by using the SMTP server of gmail. This is used to send the message with a gmail account in sender and to store the message in the outgoing elements of the gmail server.

gSMTPSession is EmailSMTPSession

gSMTPSession..ServerAddress = "localhost"

gSMTPSession..Name = "XXX@mydomain.com"

gSMTPSession..Password = ""

gSMTPSession..Port = 25

gSMTPSession..Option = emailOptionDefault

 

EmailStartSession(gSMTPSession)

 

MyMessage is Email

MyMessage..Sender = "XXX@mydomain.com"

MyMessage..SenderAddress = "XXX@mydomain.com"

  

Add(MyMessage..Recipient, "contact@test.fr")

MyMessage..Subject = "Test sent from "+NetIPAddress()

MyMessage..Message = MyMessage..Subject

 

EmailSendMessage(gSMTPSession, MyMessage)

 

EmailCloseSession(gSMTPSession)