Sending emails from a site or an application in the CLOUD

You can send emails from a site, application or webservice deployed on a CLOUD platform.


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 WLanguage functions. This server is accessible via the localhost address without having to specify any user or password.

Caution, the localhost SMTP server of each platform cannot be customized. It is therefore not suitable for emailings. 


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)