You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.8 KiB
XML
55 lines
1.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<TcPlcObject Version="1.1.0.1" ProductVersion="3.1.4024.12">
|
|
<POU Name="Send_email" Id="{600f1b92-e96b-4e8b-b192-95f8c2b46f4c}" SpecialFunc="None">
|
|
<Declaration><![CDATA[PROGRAM Send_email
|
|
VAR
|
|
// fbSendEmail : FB_SmtpV3_Full;
|
|
fbSmtpFull : FB_SmtpV3_Full;
|
|
sMessage_HTML : STRING(500) := '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><title>HTML-Test</title><body><h3>Dear SMTP-User,</h3>this e-mail was sent in HTML from <u>your PLC!</u><br/><br/>Best regards,<br/>your K3D-Team</body></html>';
|
|
nPriority : UDINT;
|
|
R_Edge : R_TRIG;
|
|
bStart : BOOL;
|
|
bBusy : BOOL;
|
|
bError : BOOL;
|
|
udErrId : UDINT;
|
|
nMailCounter : UDINT := 0;
|
|
sFiles : ARRAY [0..32] OF STRING(80) := ['c:\Temperatures.txt','c:\Log.txt']; (* TODO: Adjust file paths*)
|
|
nState : INT;
|
|
END_VAR
|
|
]]></Declaration>
|
|
<Implementation>
|
|
<ST><![CDATA[// Send email in case of critical errors
|
|
//
|
|
fbSmtpFull(
|
|
sNetId:= '',
|
|
sSmtpServer:= 'mail.company.com',
|
|
sUsername:= 'TestUser',
|
|
sPassword:= 'TestPwd',
|
|
sFrom:= 'TestUser@company.com',
|
|
sTo:= 'service@company.com',
|
|
sSubject:= 'Email from your 605 Mill Windsor',
|
|
nContentType:= 2, (* 2 = HTML *)
|
|
nPriority:= 1, (* 1 = HIGH *)
|
|
sAttachments:= sFiles,
|
|
pMessage:= ADR(sMessage_HTML),
|
|
cbMessage:= SIZEOF(sMessage_HTML),
|
|
bExecute:= bStart,
|
|
bError=> bError,
|
|
bBusy=>bBusy,
|
|
nErrId=> udErrId);
|
|
|
|
IF NOT bBusy AND NOT bError AND bStart THEN
|
|
nState := 0;
|
|
bStart := FALSE;
|
|
END_IF
|
|
]]></ST>
|
|
</Implementation>
|
|
<LineIds Name="Send_email">
|
|
<LineId Id="5" Count="0" />
|
|
<LineId Id="7" Count="0" />
|
|
<LineId Id="23" Count="20" />
|
|
<LineId Id="9" Count="0" />
|
|
<LineId Id="8" Count="0" />
|
|
</LineIds>
|
|
</POU>
|
|
</TcPlcObject> |