start of git dir

This commit is contained in:
2026-10-16 15:41:56 +03:00
commit c41e56d382
90 changed files with 5783 additions and 0 deletions
@@ -0,0 +1,3 @@
/.vscode/commandbar.json
/.vscode
/vendor/*
@@ -0,0 +1,16 @@
{
"ExpandedNodes": [
"",
"\\InjectionApi",
"\\InjectionApi\\Examples",
"\\InjectionApi\\Examples\\ExampleCode",
"\\InjectionApi\\Examples\\ExampleCode\\Basic",
"\\InjectionApi\\Examples\\Index",
"\\InjectionApi\\Examples\\Index\\Js",
"\\InjectionApi\\src",
"\\InjectionApi\\src\\Core",
"\\InjectionApi\\src\\Core\\Models"
],
"SelectedNode": "\\InjectionApi\\Examples\\Index\\Js\\Index.js",
"PreviewInSolutionExplorer": false
}
@@ -0,0 +1,972 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
IIS configuration sections.
For schema documentation, see
%IIS_BIN%\config\schema\IIS_schema.xml.
Please make a backup of this file before making any changes to it.
NOTE: The following environment variables are available to be used
within this file and are understood by the IIS Express.
%IIS_USER_HOME% - The IIS Express home directory for the user
%IIS_SITES_HOME% - The default home directory for sites
%IIS_BIN% - The location of the IIS Express binaries
%SYSTEMDRIVE% - The drive letter of %IIS_BIN%
-->
<configuration>
<!--
The <configSections> section controls the registration of sections.
Section is the basic unit of deployment, locking, searching and
containment for configuration settings.
Every section belongs to one section group.
A section group is a container of logically-related sections.
Sections cannot be nested.
Section groups may be nested.
<section
name="" [Required, Collection Key] [XML name of the section]
allowDefinition="Everywhere" [MachineOnly|MachineToApplication|AppHostOnly|Everywhere] [Level where it can be set]
overrideModeDefault="Allow" [Allow|Deny] [Default delegation mode]
allowLocation="true" [true|false] [Allowed in location tags]
/>
The recommended way to unlock sections is by using a location tag:
<location path="Default Web Site" overrideMode="Allow">
<system.webServer>
<asp />
</system.webServer>
</location>
-->
<configSections>
<sectionGroup name="system.applicationHost">
<section name="applicationPools" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="configHistory" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="customMetadata" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="listenerAdapters" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="log" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="serviceAutoStartProviders" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="sites" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="webLimits" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
</sectionGroup>
<sectionGroup name="system.webServer">
<section name="asp" overrideModeDefault="Deny" />
<section name="caching" overrideModeDefault="Allow" />
<section name="cgi" overrideModeDefault="Deny" />
<section name="defaultDocument" overrideModeDefault="Allow" />
<section name="directoryBrowse" overrideModeDefault="Allow" />
<section name="fastCgi" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="globalModules" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="handlers" overrideModeDefault="Deny" />
<section name="httpCompression" overrideModeDefault="Allow" allowDefinition="Everywhere" />
<section name="httpErrors" overrideModeDefault="Allow" />
<section name="httpLogging" overrideModeDefault="Deny" />
<section name="httpProtocol" overrideModeDefault="Allow" />
<section name="httpRedirect" overrideModeDefault="Allow" />
<section name="httpTracing" overrideModeDefault="Deny" />
<section name="isapiFilters" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
<section name="modules" allowDefinition="MachineToApplication" overrideModeDefault="Deny" />
<section name="applicationInitialization" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
<section name="odbcLogging" overrideModeDefault="Deny" />
<sectionGroup name="security">
<section name="access" overrideModeDefault="Deny" />
<section name="applicationDependencies" overrideModeDefault="Deny" />
<sectionGroup name="authentication">
<section name="anonymousAuthentication" overrideModeDefault="Deny" />
<section name="basicAuthentication" overrideModeDefault="Deny" />
<section name="clientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="digestAuthentication" overrideModeDefault="Deny" />
<section name="iisClientCertificateMappingAuthentication" overrideModeDefault="Deny" />
<section name="windowsAuthentication" overrideModeDefault="Deny" />
</sectionGroup>
<section name="authorization" overrideModeDefault="Allow" />
<section name="ipSecurity" overrideModeDefault="Deny" />
<section name="dynamicIpSecurity" overrideModeDefault="Deny" />
<section name="isapiCgiRestriction" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
<section name="requestFiltering" overrideModeDefault="Allow" />
</sectionGroup>
<section name="serverRuntime" overrideModeDefault="Deny" />
<section name="serverSideInclude" overrideModeDefault="Deny" />
<section name="staticContent" overrideModeDefault="Allow" />
<sectionGroup name="tracing">
<section name="traceFailedRequests" overrideModeDefault="Allow" />
<section name="traceProviderDefinitions" overrideModeDefault="Deny" />
</sectionGroup>
<section name="urlCompression" overrideModeDefault="Allow" />
<section name="validation" overrideModeDefault="Allow" />
<sectionGroup name="webdav">
<section name="globalSettings" overrideModeDefault="Deny" />
<section name="authoring" overrideModeDefault="Deny" />
<section name="authoringRules" overrideModeDefault="Deny" />
</sectionGroup>
<sectionGroup name="rewrite">
<section name="allowedServerVariables" overrideModeDefault="Deny" />
<section name="rules" overrideModeDefault="Allow" />
<section name="outboundRules" overrideModeDefault="Allow" />
<section name="globalRules" overrideModeDefault="Deny" allowDefinition="AppHostOnly" />
<section name="providers" overrideModeDefault="Allow" />
<section name="rewriteMaps" overrideModeDefault="Allow" />
</sectionGroup>
<section name="webSocket" overrideModeDefault="Deny" />
<section name="aspNetCore" overrideModeDefault="Allow" /></sectionGroup>
</configSections>
<configProtectedData>
<providers>
<add name="IISWASOnlyRsaProvider" type="" description="Uses RsaCryptoServiceProvider to encrypt and decrypt" keyContainerName="iisWasKey" cspProviderName="" useMachineContainer="true" useOAEP="false" />
<add name="AesProvider" type="Microsoft.ApplicationHost.AesProtectedConfigurationProvider" description="Uses an AES session key to encrypt and decrypt" keyContainerName="iisConfigurationKey" cspProviderName="" useOAEP="false" useMachineContainer="true" sessionKey="AQIAAA5mAAAApAAA/HKxkz6alrlAPez0IUgujj/6k3WxCDriHp6jvpv3yEZmo7h6SMzGLxo4mTrIQVHSkB7tmElHKfUFTzE2BWF7nFWHY6Z6qmGBauFzwJMwESjril7Gjz69RBFH259HQ6aRDq9Xfx7U7H4HtdmnKNqGjgl/hwPQBGeIlWiDh+sYv3vKB0QU971tjX6H2B+9armlnC8UOuA6JYMDMI/VLLL16sng0fWAy5JYe0YVABVjiAWDW264RZW9Tr1Oax4qHZKg+SdjULxeOc2YmpX+d0yeITo1HkPF1hN1gHpIPIUDo05ilHUNfR3OkjVCIQK4cFKCq1s8NH+y+13MxUC4Fn1AlQ==" />
<add name="IISWASOnlyAesProvider" type="Microsoft.ApplicationHost.AesProtectedConfigurationProvider" description="Uses an AES session key to encrypt and decrypt" keyContainerName="iisWasKey" cspProviderName="" useOAEP="false" useMachineContainer="true" sessionKey="AQIAAA5mAAAApAAALmU8lTC+v2qtfQiiiquvvLpUQqKLEXs+jSKoWCM/uPhyB++k4dwug19mGidNK5FYiWK2KYE1yhjVJcbp12E98Q0R2nT7eBiCMY2JairxQ591rqABK7keGaIjwH7PwGzSpILl3RJ4YFvJ/7ZXEJxeDZIjW8ZxWVXx+/VyHs9U3WguLEkgMUX3jrxJi8LouxaIVPJAv/YQ1ZCWs8zImitxX/C/7o7yaIxznfsN5nGQzQfpUDPeby99aw2zPVTtZI2LaWIBON8guABvZ6JtJVDWmfdK6sodbnwdZkr6/Z2rfvamT1dC1SpQrGG7ulR/f9/GXvCaW10ZVKxekBF/CYlNMg==" />
</providers>
</configProtectedData>
<system.applicationHost>
<applicationPools>
<add name="Clr4IntegratedAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
<add name="Clr4ClassicAppPool" managedRuntimeVersion="v4.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
<add name="Clr2IntegratedAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Integrated" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
<add name="Clr2ClassicAppPool" managedRuntimeVersion="v2.0" managedPipelineMode="Classic" CLRConfigFile="%IIS_USER_HOME%\config\aspnet.config" autoStart="true" />
<add name="UnmanagedClassicAppPool" managedRuntimeVersion="" managedPipelineMode="Classic" autoStart="true" />
<applicationPoolDefaults managedRuntimeVersion="v4.0">
<processModel loadUserProfile="true" setProfileEnvironment="false" />
</applicationPoolDefaults>
</applicationPools>
<!--
The <listenerAdapters> section defines the protocols with which the
Windows Process Activation Service (WAS) binds.
-->
<listenerAdapters>
<add name="http" />
</listenerAdapters>
<sites>
<site name="WebSite1" id="1" serverAutoStart="true">
<application path="/">
<virtualDirectory path="/" physicalPath="%IIS_SITES_HOME%\WebSite1" />
</application>
<bindings>
<binding protocol="http" bindingInformation=":8080:localhost" />
</bindings>
</site>
<siteDefaults>
<!-- To enable logging, please change the below attribute "enabled" to "true" -->
<logFile logFormat="W3C" directory="%AppData%\Microsoft\IISExpressLogs" enabled="false" />
<traceFailedRequestsLogging directory="%AppData%\Microsoft" enabled="false" maxLogFileSizeKB="1024" />
</siteDefaults>
<applicationDefaults applicationPool="Clr4IntegratedAppPool" />
<virtualDirectoryDefaults allowSubDirConfig="true" />
</sites>
<webLimits />
</system.applicationHost>
<system.webServer>
<serverRuntime />
<asp scriptErrorSentToBrowser="true">
<cache diskTemplateCacheDirectory="%TEMP%\iisexpress\ASP Compiled Templates" />
<limits />
</asp>
<caching enabled="true" enableKernelCache="true">
</caching>
<cgi />
<defaultDocument enabled="true">
<files>
<add value="Default.htm" />
<add value="Default.asp" />
<add value="index.htm" />
<add value="index.html" />
<add value="iisstart.htm" />
<add value="default.aspx" />
</files>
</defaultDocument>
<directoryBrowse enabled="false" />
<fastCgi />
<!--
The <globalModules> section defines all native-code modules.
To enable a module, specify it in the <modules> section.
-->
<globalModules>
<add name="HttpLoggingModule" image="%IIS_BIN%\loghttp.dll" />
<add name="UriCacheModule" image="%IIS_BIN%\cachuri.dll" />
<add name="TokenCacheModule" image="%IIS_BIN%\cachtokn.dll" />
<add name="DynamicCompressionModule" image="%IIS_BIN%\compdyn.dll" />
<add name="StaticCompressionModule" image="%IIS_BIN%\compstat.dll" />
<add name="DefaultDocumentModule" image="%IIS_BIN%\defdoc.dll" />
<add name="DirectoryListingModule" image="%IIS_BIN%\dirlist.dll" />
<add name="ProtocolSupportModule" image="%IIS_BIN%\protsup.dll" />
<add name="HttpRedirectionModule" image="%IIS_BIN%\redirect.dll" />
<add name="ServerSideIncludeModule" image="%IIS_BIN%\iis_ssi.dll" />
<add name="StaticFileModule" image="%IIS_BIN%\static.dll" />
<add name="AnonymousAuthenticationModule" image="%IIS_BIN%\authanon.dll" />
<add name="CertificateMappingAuthenticationModule" image="%IIS_BIN%\authcert.dll" />
<add name="UrlAuthorizationModule" image="%IIS_BIN%\urlauthz.dll" />
<add name="BasicAuthenticationModule" image="%IIS_BIN%\authbas.dll" />
<add name="WindowsAuthenticationModule" image="%IIS_BIN%\authsspi.dll" />
<add name="IISCertificateMappingAuthenticationModule" image="%IIS_BIN%\authmap.dll" />
<add name="IpRestrictionModule" image="%IIS_BIN%\iprestr.dll" />
<add name="DynamicIpRestrictionModule" image="%IIS_BIN%\diprestr.dll" />
<add name="RequestFilteringModule" image="%IIS_BIN%\modrqflt.dll" />
<add name="CustomLoggingModule" image="%IIS_BIN%\logcust.dll" />
<add name="CustomErrorModule" image="%IIS_BIN%\custerr.dll" />
<add name="FailedRequestsTracingModule" image="%IIS_BIN%\iisfreb.dll" />
<add name="RequestMonitorModule" image="%IIS_BIN%\iisreqs.dll" />
<add name="IsapiModule" image="%IIS_BIN%\isapi.dll" />
<add name="IsapiFilterModule" image="%IIS_BIN%\filter.dll" />
<add name="CgiModule" image="%IIS_BIN%\cgi.dll" />
<add name="FastCgiModule" image="%IIS_BIN%\iisfcgi.dll" />
<!-- <add name="WebDAVModule" image="%IIS_BIN%\webdav.dll" /> -->
<add name="RewriteModule" image="%IIS_BIN%\rewrite.dll" />
<add name="ConfigurationValidationModule" image="%IIS_BIN%\validcfg.dll" />
<add name="WebSocketModule" image="%IIS_BIN%\iiswsock.dll" />
<add name="WebMatrixSupportModule" image="%IIS_BIN%\webmatrixsup.dll" />
<add name="ManagedEngine" image="%windir%\Microsoft.NET\Framework\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness32" />
<add name="ManagedEngine64" image="%windir%\Microsoft.NET\Framework64\v2.0.50727\webengine.dll" preCondition="integratedMode,runtimeVersionv2.0,bitness64" />
<add name="ManagedEngineV4.0_32bit" image="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness32" />
<add name="ManagedEngineV4.0_64bit" image="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" preCondition="integratedMode,runtimeVersionv4.0,bitness64" />
<add name="ApplicationInitializationModule" image="%IIS_BIN%\warmup.dll" />
<add name="AspNetCoreModuleV2" image="%IIS_BIN%\Asp.Net Core Module\V2\aspnetcorev2.dll" />
</globalModules>
<httpCompression directory="%TEMP%">
<scheme name="gzip" dll="%IIS_BIN%\gzip.dll" />
<dynamicTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/x-javascript" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="*/*" enabled="false" />
<add mimeType="text/event-stream" enabled="false" />
</dynamicTypes>
<staticTypes>
<add mimeType="text/*" enabled="true" />
<add mimeType="message/*" enabled="true" />
<add mimeType="application/javascript" enabled="true" />
<add mimeType="application/atom+xml" enabled="true" />
<add mimeType="application/xaml+xml" enabled="true" />
<add mimeType="image/svg+xml" enabled="true" />
<add mimeType="*/*" enabled="false" />
</staticTypes>
</httpCompression>
<httpErrors lockAttributes="allowAbsolutePathsWhenDelegated,defaultPath">
<error statusCode="401" prefixLanguageFilePath="%IIS_BIN%\custerr" path="401.htm" />
<error statusCode="403" prefixLanguageFilePath="%IIS_BIN%\custerr" path="403.htm" />
<error statusCode="404" prefixLanguageFilePath="%IIS_BIN%\custerr" path="404.htm" />
<error statusCode="405" prefixLanguageFilePath="%IIS_BIN%\custerr" path="405.htm" />
<error statusCode="406" prefixLanguageFilePath="%IIS_BIN%\custerr" path="406.htm" />
<error statusCode="412" prefixLanguageFilePath="%IIS_BIN%\custerr" path="412.htm" />
<error statusCode="500" prefixLanguageFilePath="%IIS_BIN%\custerr" path="500.htm" />
<error statusCode="501" prefixLanguageFilePath="%IIS_BIN%\custerr" path="501.htm" />
<error statusCode="502" prefixLanguageFilePath="%IIS_BIN%\custerr" path="502.htm" />
</httpErrors>
<httpLogging dontLog="false" />
<httpProtocol>
<customHeaders>
<clear />
<add name="X-Powered-By" value="ASP.NET" />
</customHeaders>
<redirectHeaders>
<clear />
</redirectHeaders>
</httpProtocol>
<httpRedirect enabled="false" />
<httpTracing />
<isapiFilters>
<filter name="ASP.Net_2.0.50727-64" path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness64,runtimeVersionv2.0" />
<filter name="ASP.Net_2.0.50727.0" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv2.0" />
<filter name="ASP.Net_2.0_for_v1.1" path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_filter.dll" enableCache="true" preCondition="runtimeVersionv1.1" />
<filter name="ASP.Net_4.0_32bit" path="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="bitness32,runtimeVersionv4.0" />
<filter name="ASP.Net_4.0_64bit" path="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_filter.dll" enableCache="true" preCondition="bitness64,runtimeVersionv4.0" />
</isapiFilters>
<odbcLogging />
<security>
<access sslFlags="None" />
<applicationDependencies>
<application name="Active Server Pages" groupId="ASP" />
</applicationDependencies>
<authentication>
<anonymousAuthentication enabled="true" userName="" />
<basicAuthentication enabled="false" />
<clientCertificateMappingAuthentication enabled="false" />
<digestAuthentication enabled="false" />
<iisClientCertificateMappingAuthentication enabled="false">
</iisClientCertificateMappingAuthentication>
<windowsAuthentication enabled="false">
<providers>
<add value="Negotiate" />
<add value="NTLM" />
</providers>
</windowsAuthentication>
</authentication>
<authorization>
<add accessType="Allow" users="*" />
</authorization>
<ipSecurity allowUnlisted="true" />
<isapiCgiRestriction notListedIsapisAllowed="true" notListedCgisAllowed="true">
<add path="%windir%\Microsoft.NET\Framework64\v4.0.30319\webengine4.dll" allowed="true" groupId="ASP.NET_v4.0" description="ASP.NET_v4.0" />
<add path="%windir%\Microsoft.NET\Framework\v4.0.30319\webengine4.dll" allowed="true" groupId="ASP.NET_v4.0" description="ASP.NET_v4.0" />
<add path="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
<add path="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" allowed="true" groupId="ASP.NET v2.0.50727" description="ASP.NET v2.0.50727" />
</isapiCgiRestriction>
<requestFiltering>
<fileExtensions allowUnlisted="true" applyToWebDAV="true">
<add fileExtension=".asa" allowed="false" />
<add fileExtension=".asax" allowed="false" />
<add fileExtension=".ascx" allowed="false" />
<add fileExtension=".master" allowed="false" />
<add fileExtension=".skin" allowed="false" />
<add fileExtension=".browser" allowed="false" />
<add fileExtension=".sitemap" allowed="false" />
<add fileExtension=".config" allowed="false" />
<add fileExtension=".cs" allowed="false" />
<add fileExtension=".csproj" allowed="false" />
<add fileExtension=".vb" allowed="false" />
<add fileExtension=".vbproj" allowed="false" />
<add fileExtension=".webinfo" allowed="false" />
<add fileExtension=".licx" allowed="false" />
<add fileExtension=".resx" allowed="false" />
<add fileExtension=".resources" allowed="false" />
<add fileExtension=".mdb" allowed="false" />
<add fileExtension=".vjsproj" allowed="false" />
<add fileExtension=".java" allowed="false" />
<add fileExtension=".jsl" allowed="false" />
<add fileExtension=".ldb" allowed="false" />
<add fileExtension=".dsdgm" allowed="false" />
<add fileExtension=".ssdgm" allowed="false" />
<add fileExtension=".lsad" allowed="false" />
<add fileExtension=".ssmap" allowed="false" />
<add fileExtension=".cd" allowed="false" />
<add fileExtension=".dsprototype" allowed="false" />
<add fileExtension=".lsaprototype" allowed="false" />
<add fileExtension=".sdm" allowed="false" />
<add fileExtension=".sdmDocument" allowed="false" />
<add fileExtension=".mdf" allowed="false" />
<add fileExtension=".ldf" allowed="false" />
<add fileExtension=".ad" allowed="false" />
<add fileExtension=".dd" allowed="false" />
<add fileExtension=".ldd" allowed="false" />
<add fileExtension=".sd" allowed="false" />
<add fileExtension=".adprototype" allowed="false" />
<add fileExtension=".lddprototype" allowed="false" />
<add fileExtension=".exclude" allowed="false" />
<add fileExtension=".refresh" allowed="false" />
<add fileExtension=".compiled" allowed="false" />
<add fileExtension=".msgx" allowed="false" />
<add fileExtension=".vsdisco" allowed="false" />
<add fileExtension=".rules" allowed="false" />
</fileExtensions>
<verbs allowUnlisted="true" applyToWebDAV="true" />
<hiddenSegments applyToWebDAV="true">
<add segment="web.config" />
<add segment="bin" />
<add segment="App_code" />
<add segment="App_GlobalResources" />
<add segment="App_LocalResources" />
<add segment="App_WebReferences" />
<add segment="App_Data" />
<add segment="App_Browsers" />
</hiddenSegments>
</requestFiltering>
</security>
<serverSideInclude ssiExecDisable="false" />
<staticContent lockAttributes="isDocFooterFileName">
<mimeMap fileExtension=".323" mimeType="text/h323" />
<mimeMap fileExtension=".3g2" mimeType="video/3gpp2" />
<mimeMap fileExtension=".3gp2" mimeType="video/3gpp2" />
<mimeMap fileExtension=".3gp" mimeType="video/3gpp" />
<mimeMap fileExtension=".3gpp" mimeType="video/3gpp" />
<mimeMap fileExtension=".aac" mimeType="audio/aac" />
<mimeMap fileExtension=".aaf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".aca" mimeType="application/octet-stream" />
<mimeMap fileExtension=".accdb" mimeType="application/msaccess" />
<mimeMap fileExtension=".accde" mimeType="application/msaccess" />
<mimeMap fileExtension=".accdt" mimeType="application/msaccess" />
<mimeMap fileExtension=".acx" mimeType="application/internet-property-stream" />
<mimeMap fileExtension=".adt" mimeType="audio/vnd.dlna.adts" />
<mimeMap fileExtension=".adts" mimeType="audio/vnd.dlna.adts" />
<mimeMap fileExtension=".afm" mimeType="application/octet-stream" />
<mimeMap fileExtension=".ai" mimeType="application/postscript" />
<mimeMap fileExtension=".aif" mimeType="audio/x-aiff" />
<mimeMap fileExtension=".aifc" mimeType="audio/aiff" />
<mimeMap fileExtension=".aiff" mimeType="audio/aiff" />
<mimeMap fileExtension=".appcache" mimeType="text/cache-manifest" />
<mimeMap fileExtension=".application" mimeType="application/x-ms-application" />
<mimeMap fileExtension=".art" mimeType="image/x-jg" />
<mimeMap fileExtension=".asd" mimeType="application/octet-stream" />
<mimeMap fileExtension=".asf" mimeType="video/x-ms-asf" />
<mimeMap fileExtension=".asi" mimeType="application/octet-stream" />
<mimeMap fileExtension=".asm" mimeType="text/plain" />
<mimeMap fileExtension=".asr" mimeType="video/x-ms-asf" />
<mimeMap fileExtension=".asx" mimeType="video/x-ms-asf" />
<mimeMap fileExtension=".atom" mimeType="application/atom+xml" />
<mimeMap fileExtension=".au" mimeType="audio/basic" />
<mimeMap fileExtension=".avi" mimeType="video/avi" />
<mimeMap fileExtension=".axs" mimeType="application/olescript" />
<mimeMap fileExtension=".bas" mimeType="text/plain" />
<mimeMap fileExtension=".bcpio" mimeType="application/x-bcpio" />
<mimeMap fileExtension=".bin" mimeType="application/octet-stream" />
<mimeMap fileExtension=".bmp" mimeType="image/bmp" />
<mimeMap fileExtension=".c" mimeType="text/plain" />
<mimeMap fileExtension=".cab" mimeType="application/vnd.ms-cab-compressed" />
<mimeMap fileExtension=".calx" mimeType="application/vnd.ms-office.calx" />
<mimeMap fileExtension=".cat" mimeType="application/vnd.ms-pki.seccat" />
<mimeMap fileExtension=".cdf" mimeType="application/x-cdf" />
<mimeMap fileExtension=".chm" mimeType="application/octet-stream" />
<mimeMap fileExtension=".class" mimeType="application/x-java-applet" />
<mimeMap fileExtension=".clp" mimeType="application/x-msclip" />
<mimeMap fileExtension=".cmx" mimeType="image/x-cmx" />
<mimeMap fileExtension=".cnf" mimeType="text/plain" />
<mimeMap fileExtension=".cod" mimeType="image/cis-cod" />
<mimeMap fileExtension=".cpio" mimeType="application/x-cpio" />
<mimeMap fileExtension=".cpp" mimeType="text/plain" />
<mimeMap fileExtension=".crd" mimeType="application/x-mscardfile" />
<mimeMap fileExtension=".crl" mimeType="application/pkix-crl" />
<mimeMap fileExtension=".crt" mimeType="application/x-x509-ca-cert" />
<mimeMap fileExtension=".csh" mimeType="application/x-csh" />
<mimeMap fileExtension=".css" mimeType="text/css" />
<mimeMap fileExtension=".csv" mimeType="application/octet-stream" />
<mimeMap fileExtension=".cur" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dcr" mimeType="application/x-director" />
<mimeMap fileExtension=".deploy" mimeType="application/octet-stream" />
<mimeMap fileExtension=".der" mimeType="application/x-x509-ca-cert" />
<mimeMap fileExtension=".dib" mimeType="image/bmp" />
<mimeMap fileExtension=".dir" mimeType="application/x-director" />
<mimeMap fileExtension=".disco" mimeType="text/xml" />
<mimeMap fileExtension=".dll" mimeType="application/x-msdownload" />
<mimeMap fileExtension=".dll.config" mimeType="text/xml" />
<mimeMap fileExtension=".dlm" mimeType="text/dlm" />
<mimeMap fileExtension=".doc" mimeType="application/msword" />
<mimeMap fileExtension=".docm" mimeType="application/vnd.ms-word.document.macroEnabled.12" />
<mimeMap fileExtension=".docx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<mimeMap fileExtension=".dot" mimeType="application/msword" />
<mimeMap fileExtension=".dotm" mimeType="application/vnd.ms-word.template.macroEnabled.12" />
<mimeMap fileExtension=".dotx" mimeType="application/vnd.openxmlformats-officedocument.wordprocessingml.template" />
<mimeMap fileExtension=".dsp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dtd" mimeType="text/xml" />
<mimeMap fileExtension=".dvi" mimeType="application/x-dvi" />
<mimeMap fileExtension=".dvr-ms" mimeType="video/x-ms-dvr" />
<mimeMap fileExtension=".dwf" mimeType="drawing/x-dwf" />
<mimeMap fileExtension=".dwp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".dxr" mimeType="application/x-director" />
<mimeMap fileExtension=".eml" mimeType="message/rfc822" />
<mimeMap fileExtension=".emz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
<mimeMap fileExtension=".eps" mimeType="application/postscript" />
<mimeMap fileExtension=".esd" mimeType="application/vnd.ms-cab-compressed" />
<mimeMap fileExtension=".etx" mimeType="text/x-setext" />
<mimeMap fileExtension=".evy" mimeType="application/envoy" />
<mimeMap fileExtension=".exe" mimeType="application/octet-stream" />
<mimeMap fileExtension=".exe.config" mimeType="text/xml" />
<mimeMap fileExtension=".fdf" mimeType="application/vnd.fdf" />
<mimeMap fileExtension=".fif" mimeType="application/fractals" />
<mimeMap fileExtension=".fla" mimeType="application/octet-stream" />
<mimeMap fileExtension=".flr" mimeType="x-world/x-vrml" />
<mimeMap fileExtension=".flv" mimeType="video/x-flv" />
<mimeMap fileExtension=".gif" mimeType="image/gif" />
<mimeMap fileExtension=".glb" mimeType="model/gltf-binary" />
<mimeMap fileExtension=".gtar" mimeType="application/x-gtar" />
<mimeMap fileExtension=".gz" mimeType="application/x-gzip" />
<mimeMap fileExtension=".h" mimeType="text/plain" />
<mimeMap fileExtension=".hdf" mimeType="application/x-hdf" />
<mimeMap fileExtension=".hdml" mimeType="text/x-hdml" />
<mimeMap fileExtension=".hhc" mimeType="application/x-oleobject" />
<mimeMap fileExtension=".hhk" mimeType="application/octet-stream" />
<mimeMap fileExtension=".hhp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".hlp" mimeType="application/winhlp" />
<mimeMap fileExtension=".hqx" mimeType="application/mac-binhex40" />
<mimeMap fileExtension=".hta" mimeType="application/hta" />
<mimeMap fileExtension=".htc" mimeType="text/x-component" />
<mimeMap fileExtension=".htm" mimeType="text/html" />
<mimeMap fileExtension=".html" mimeType="text/html" />
<mimeMap fileExtension=".htt" mimeType="text/webviewhtml" />
<mimeMap fileExtension=".hxt" mimeType="text/html" />
<mimeMap fileExtension=".ico" mimeType="image/x-icon" />
<mimeMap fileExtension=".ics" mimeType="text/calendar" />
<mimeMap fileExtension=".ief" mimeType="image/ief" />
<mimeMap fileExtension=".iii" mimeType="application/x-iphone" />
<mimeMap fileExtension=".inf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".ins" mimeType="application/x-internet-signup" />
<mimeMap fileExtension=".isp" mimeType="application/x-internet-signup" />
<mimeMap fileExtension=".IVF" mimeType="video/x-ivf" />
<mimeMap fileExtension=".jar" mimeType="application/java-archive" />
<mimeMap fileExtension=".java" mimeType="application/octet-stream" />
<mimeMap fileExtension=".jck" mimeType="application/liquidmotion" />
<mimeMap fileExtension=".jcz" mimeType="application/liquidmotion" />
<mimeMap fileExtension=".jfif" mimeType="image/pjpeg" />
<mimeMap fileExtension=".jpb" mimeType="application/octet-stream" />
<mimeMap fileExtension=".jpe" mimeType="image/jpeg" />
<mimeMap fileExtension=".jpeg" mimeType="image/jpeg" />
<mimeMap fileExtension=".jpg" mimeType="image/jpeg" />
<mimeMap fileExtension=".js" mimeType="application/javascript" />
<mimeMap fileExtension=".json" mimeType="application/json" />
<mimeMap fileExtension=".jsonld" mimeType="application/ld+json" />
<mimeMap fileExtension=".jsx" mimeType="text/jscript" />
<mimeMap fileExtension=".latex" mimeType="application/x-latex" />
<mimeMap fileExtension=".less" mimeType="text/css" />
<mimeMap fileExtension=".lit" mimeType="application/x-ms-reader" />
<mimeMap fileExtension=".lpk" mimeType="application/octet-stream" />
<mimeMap fileExtension=".lsf" mimeType="video/x-la-asf" />
<mimeMap fileExtension=".lsx" mimeType="video/x-la-asf" />
<mimeMap fileExtension=".lzh" mimeType="application/octet-stream" />
<mimeMap fileExtension=".m13" mimeType="application/x-msmediaview" />
<mimeMap fileExtension=".m14" mimeType="application/x-msmediaview" />
<mimeMap fileExtension=".m1v" mimeType="video/mpeg" />
<mimeMap fileExtension=".m2ts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".m3u" mimeType="audio/x-mpegurl" />
<mimeMap fileExtension=".m4a" mimeType="audio/mp4" />
<mimeMap fileExtension=".m4v" mimeType="video/mp4" />
<mimeMap fileExtension=".man" mimeType="application/x-troff-man" />
<mimeMap fileExtension=".manifest" mimeType="application/x-ms-manifest" />
<mimeMap fileExtension=".map" mimeType="text/plain" />
<mimeMap fileExtension=".mdb" mimeType="application/x-msaccess" />
<mimeMap fileExtension=".mdp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".me" mimeType="application/x-troff-me" />
<mimeMap fileExtension=".mht" mimeType="message/rfc822" />
<mimeMap fileExtension=".mhtml" mimeType="message/rfc822" />
<mimeMap fileExtension=".mid" mimeType="audio/mid" />
<mimeMap fileExtension=".midi" mimeType="audio/mid" />
<mimeMap fileExtension=".mix" mimeType="application/octet-stream" />
<mimeMap fileExtension=".mmf" mimeType="application/x-smaf" />
<mimeMap fileExtension=".mno" mimeType="text/xml" />
<mimeMap fileExtension=".mny" mimeType="application/x-msmoney" />
<mimeMap fileExtension=".mov" mimeType="video/quicktime" />
<mimeMap fileExtension=".movie" mimeType="video/x-sgi-movie" />
<mimeMap fileExtension=".mp2" mimeType="video/mpeg" />
<mimeMap fileExtension=".mp3" mimeType="audio/mpeg" />
<mimeMap fileExtension=".mp4" mimeType="video/mp4" />
<mimeMap fileExtension=".mp4v" mimeType="video/mp4" />
<mimeMap fileExtension=".mpa" mimeType="video/mpeg" />
<mimeMap fileExtension=".mpe" mimeType="video/mpeg" />
<mimeMap fileExtension=".mpeg" mimeType="video/mpeg" />
<mimeMap fileExtension=".mpg" mimeType="video/mpeg" />
<mimeMap fileExtension=".mpp" mimeType="application/vnd.ms-project" />
<mimeMap fileExtension=".mpv2" mimeType="video/mpeg" />
<mimeMap fileExtension=".ms" mimeType="application/x-troff-ms" />
<mimeMap fileExtension=".msi" mimeType="application/octet-stream" />
<mimeMap fileExtension=".mso" mimeType="application/octet-stream" />
<mimeMap fileExtension=".mvb" mimeType="application/x-msmediaview" />
<mimeMap fileExtension=".mvc" mimeType="application/x-miva-compiled" />
<mimeMap fileExtension=".nc" mimeType="application/x-netcdf" />
<mimeMap fileExtension=".nsc" mimeType="video/x-ms-asf" />
<mimeMap fileExtension=".nws" mimeType="message/rfc822" />
<mimeMap fileExtension=".ocx" mimeType="application/octet-stream" />
<mimeMap fileExtension=".oda" mimeType="application/oda" />
<mimeMap fileExtension=".odc" mimeType="text/x-ms-odc" />
<mimeMap fileExtension=".ods" mimeType="application/oleobject" />
<mimeMap fileExtension=".oga" mimeType="audio/ogg" />
<mimeMap fileExtension=".ogg" mimeType="video/ogg" />
<mimeMap fileExtension=".ogv" mimeType="video/ogg" />
<mimeMap fileExtension=".one" mimeType="application/onenote" />
<mimeMap fileExtension=".onea" mimeType="application/onenote" />
<mimeMap fileExtension=".onetoc" mimeType="application/onenote" />
<mimeMap fileExtension=".onetoc2" mimeType="application/onenote" />
<mimeMap fileExtension=".onetmp" mimeType="application/onenote" />
<mimeMap fileExtension=".onepkg" mimeType="application/onenote" />
<mimeMap fileExtension=".osdx" mimeType="application/opensearchdescription+xml" />
<mimeMap fileExtension=".otf" mimeType="font/otf" />
<mimeMap fileExtension=".p10" mimeType="application/pkcs10" />
<mimeMap fileExtension=".p12" mimeType="application/x-pkcs12" />
<mimeMap fileExtension=".p7b" mimeType="application/x-pkcs7-certificates" />
<mimeMap fileExtension=".p7c" mimeType="application/pkcs7-mime" />
<mimeMap fileExtension=".p7m" mimeType="application/pkcs7-mime" />
<mimeMap fileExtension=".p7r" mimeType="application/x-pkcs7-certreqresp" />
<mimeMap fileExtension=".p7s" mimeType="application/pkcs7-signature" />
<mimeMap fileExtension=".pbm" mimeType="image/x-portable-bitmap" />
<mimeMap fileExtension=".pcx" mimeType="application/octet-stream" />
<mimeMap fileExtension=".pcz" mimeType="application/octet-stream" />
<mimeMap fileExtension=".pdf" mimeType="application/pdf" />
<mimeMap fileExtension=".pfb" mimeType="application/octet-stream" />
<mimeMap fileExtension=".pfm" mimeType="application/octet-stream" />
<mimeMap fileExtension=".pfx" mimeType="application/x-pkcs12" />
<mimeMap fileExtension=".pgm" mimeType="image/x-portable-graymap" />
<mimeMap fileExtension=".pko" mimeType="application/vnd.ms-pki.pko" />
<mimeMap fileExtension=".pma" mimeType="application/x-perfmon" />
<mimeMap fileExtension=".pmc" mimeType="application/x-perfmon" />
<mimeMap fileExtension=".pml" mimeType="application/x-perfmon" />
<mimeMap fileExtension=".pmr" mimeType="application/x-perfmon" />
<mimeMap fileExtension=".pmw" mimeType="application/x-perfmon" />
<mimeMap fileExtension=".png" mimeType="image/png" />
<mimeMap fileExtension=".pnm" mimeType="image/x-portable-anymap" />
<mimeMap fileExtension=".pnz" mimeType="image/png" />
<mimeMap fileExtension=".pot" mimeType="application/vnd.ms-powerpoint" />
<mimeMap fileExtension=".potm" mimeType="application/vnd.ms-powerpoint.template.macroEnabled.12" />
<mimeMap fileExtension=".potx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.template" />
<mimeMap fileExtension=".ppam" mimeType="application/vnd.ms-powerpoint.addin.macroEnabled.12" />
<mimeMap fileExtension=".ppm" mimeType="image/x-portable-pixmap" />
<mimeMap fileExtension=".pps" mimeType="application/vnd.ms-powerpoint" />
<mimeMap fileExtension=".ppsm" mimeType="application/vnd.ms-powerpoint.slideshow.macroEnabled.12" />
<mimeMap fileExtension=".ppsx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slideshow" />
<mimeMap fileExtension=".ppt" mimeType="application/vnd.ms-powerpoint" />
<mimeMap fileExtension=".pptm" mimeType="application/vnd.ms-powerpoint.presentation.macroEnabled.12" />
<mimeMap fileExtension=".pptx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.presentation" />
<mimeMap fileExtension=".prf" mimeType="application/pics-rules" />
<mimeMap fileExtension=".prm" mimeType="application/octet-stream" />
<mimeMap fileExtension=".prx" mimeType="application/octet-stream" />
<mimeMap fileExtension=".ps" mimeType="application/postscript" />
<mimeMap fileExtension=".psd" mimeType="application/octet-stream" />
<mimeMap fileExtension=".psm" mimeType="application/octet-stream" />
<mimeMap fileExtension=".psp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".pub" mimeType="application/x-mspublisher" />
<mimeMap fileExtension=".qt" mimeType="video/quicktime" />
<mimeMap fileExtension=".qtl" mimeType="application/x-quicktimeplayer" />
<mimeMap fileExtension=".qxd" mimeType="application/octet-stream" />
<mimeMap fileExtension=".ra" mimeType="audio/x-pn-realaudio" />
<mimeMap fileExtension=".ram" mimeType="audio/x-pn-realaudio" />
<mimeMap fileExtension=".rar" mimeType="application/octet-stream" />
<mimeMap fileExtension=".ras" mimeType="image/x-cmu-raster" />
<mimeMap fileExtension=".rf" mimeType="image/vnd.rn-realflash" />
<mimeMap fileExtension=".rgb" mimeType="image/x-rgb" />
<mimeMap fileExtension=".rm" mimeType="application/vnd.rn-realmedia" />
<mimeMap fileExtension=".rmi" mimeType="audio/mid" />
<mimeMap fileExtension=".roff" mimeType="application/x-troff" />
<mimeMap fileExtension=".rpm" mimeType="audio/x-pn-realaudio-plugin" />
<mimeMap fileExtension=".rtf" mimeType="application/rtf" />
<mimeMap fileExtension=".rtx" mimeType="text/richtext" />
<mimeMap fileExtension=".scd" mimeType="application/x-msschedule" />
<mimeMap fileExtension=".sct" mimeType="text/scriptlet" />
<mimeMap fileExtension=".sea" mimeType="application/octet-stream" />
<mimeMap fileExtension=".setpay" mimeType="application/set-payment-initiation" />
<mimeMap fileExtension=".setreg" mimeType="application/set-registration-initiation" />
<mimeMap fileExtension=".sgml" mimeType="text/sgml" />
<mimeMap fileExtension=".sh" mimeType="application/x-sh" />
<mimeMap fileExtension=".shar" mimeType="application/x-shar" />
<mimeMap fileExtension=".sit" mimeType="application/x-stuffit" />
<mimeMap fileExtension=".sldm" mimeType="application/vnd.ms-powerpoint.slide.macroEnabled.12" />
<mimeMap fileExtension=".sldx" mimeType="application/vnd.openxmlformats-officedocument.presentationml.slide" />
<mimeMap fileExtension=".smd" mimeType="audio/x-smd" />
<mimeMap fileExtension=".smi" mimeType="application/octet-stream" />
<mimeMap fileExtension=".smx" mimeType="audio/x-smd" />
<mimeMap fileExtension=".smz" mimeType="audio/x-smd" />
<mimeMap fileExtension=".snd" mimeType="audio/basic" />
<mimeMap fileExtension=".snp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".spc" mimeType="application/x-pkcs7-certificates" />
<mimeMap fileExtension=".spl" mimeType="application/futuresplash" />
<mimeMap fileExtension=".spx" mimeType="audio/ogg" />
<mimeMap fileExtension=".src" mimeType="application/x-wais-source" />
<mimeMap fileExtension=".ssm" mimeType="application/streamingmedia" />
<mimeMap fileExtension=".sst" mimeType="application/vnd.ms-pki.certstore" />
<mimeMap fileExtension=".stl" mimeType="application/vnd.ms-pki.stl" />
<mimeMap fileExtension=".sv4cpio" mimeType="application/x-sv4cpio" />
<mimeMap fileExtension=".sv4crc" mimeType="application/x-sv4crc" />
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
<mimeMap fileExtension=".svgz" mimeType="image/svg+xml" />
<mimeMap fileExtension=".swf" mimeType="application/x-shockwave-flash" />
<mimeMap fileExtension=".t" mimeType="application/x-troff" />
<mimeMap fileExtension=".tar" mimeType="application/x-tar" />
<mimeMap fileExtension=".tcl" mimeType="application/x-tcl" />
<mimeMap fileExtension=".tex" mimeType="application/x-tex" />
<mimeMap fileExtension=".texi" mimeType="application/x-texinfo" />
<mimeMap fileExtension=".texinfo" mimeType="application/x-texinfo" />
<mimeMap fileExtension=".tgz" mimeType="application/x-compressed" />
<mimeMap fileExtension=".thmx" mimeType="application/vnd.ms-officetheme" />
<mimeMap fileExtension=".thn" mimeType="application/octet-stream" />
<mimeMap fileExtension=".tif" mimeType="image/tiff" />
<mimeMap fileExtension=".tiff" mimeType="image/tiff" />
<mimeMap fileExtension=".toc" mimeType="application/octet-stream" />
<mimeMap fileExtension=".tr" mimeType="application/x-troff" />
<mimeMap fileExtension=".trm" mimeType="application/x-msterminal" />
<mimeMap fileExtension=".ts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".tsv" mimeType="text/tab-separated-values" />
<mimeMap fileExtension=".ttf" mimeType="application/octet-stream" />
<mimeMap fileExtension=".tts" mimeType="video/vnd.dlna.mpeg-tts" />
<mimeMap fileExtension=".txt" mimeType="text/plain" />
<mimeMap fileExtension=".u32" mimeType="application/octet-stream" />
<mimeMap fileExtension=".uls" mimeType="text/iuls" />
<mimeMap fileExtension=".ustar" mimeType="application/x-ustar" />
<mimeMap fileExtension=".vbs" mimeType="text/vbscript" />
<mimeMap fileExtension=".vcf" mimeType="text/x-vcard" />
<mimeMap fileExtension=".vcs" mimeType="text/plain" />
<mimeMap fileExtension=".vdx" mimeType="application/vnd.ms-visio.viewer" />
<mimeMap fileExtension=".vml" mimeType="text/xml" />
<mimeMap fileExtension=".vsd" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".vss" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".vst" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".vsto" mimeType="application/x-ms-vsto" />
<mimeMap fileExtension=".vsw" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".vsx" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".vtx" mimeType="application/vnd.visio" />
<mimeMap fileExtension=".wasm" mimeType="application/wasm" />
<mimeMap fileExtension=".wav" mimeType="audio/wav" />
<mimeMap fileExtension=".wax" mimeType="audio/x-ms-wax" />
<mimeMap fileExtension=".wbmp" mimeType="image/vnd.wap.wbmp" />
<mimeMap fileExtension=".wcm" mimeType="application/vnd.ms-works" />
<mimeMap fileExtension=".wdb" mimeType="application/vnd.ms-works" />
<mimeMap fileExtension=".webm" mimeType="video/webm" />
<mimeMap fileExtension=".wks" mimeType="application/vnd.ms-works" />
<mimeMap fileExtension=".wm" mimeType="video/x-ms-wm" />
<mimeMap fileExtension=".wma" mimeType="audio/x-ms-wma" />
<mimeMap fileExtension=".wmd" mimeType="application/x-ms-wmd" />
<mimeMap fileExtension=".wmf" mimeType="application/x-msmetafile" />
<mimeMap fileExtension=".wml" mimeType="text/vnd.wap.wml" />
<mimeMap fileExtension=".wmlc" mimeType="application/vnd.wap.wmlc" />
<mimeMap fileExtension=".wmls" mimeType="text/vnd.wap.wmlscript" />
<mimeMap fileExtension=".wmlsc" mimeType="application/vnd.wap.wmlscriptc" />
<mimeMap fileExtension=".wmp" mimeType="video/x-ms-wmp" />
<mimeMap fileExtension=".wmv" mimeType="video/x-ms-wmv" />
<mimeMap fileExtension=".wmx" mimeType="video/x-ms-wmx" />
<mimeMap fileExtension=".wmz" mimeType="application/x-ms-wmz" />
<mimeMap fileExtension=".woff" mimeType="font/x-woff" />
<mimeMap fileExtension=".woff2" mimeType="application/font-woff2" />
<mimeMap fileExtension=".wps" mimeType="application/vnd.ms-works" />
<mimeMap fileExtension=".wri" mimeType="application/x-mswrite" />
<mimeMap fileExtension=".wrl" mimeType="x-world/x-vrml" />
<mimeMap fileExtension=".wrz" mimeType="x-world/x-vrml" />
<mimeMap fileExtension=".wsdl" mimeType="text/xml" />
<mimeMap fileExtension=".wtv" mimeType="video/x-ms-wtv" />
<mimeMap fileExtension=".wvx" mimeType="video/x-ms-wvx" />
<mimeMap fileExtension=".x" mimeType="application/directx" />
<mimeMap fileExtension=".xaf" mimeType="x-world/x-vrml" />
<mimeMap fileExtension=".xaml" mimeType="application/xaml+xml" />
<mimeMap fileExtension=".xap" mimeType="application/x-silverlight-app" />
<mimeMap fileExtension=".xbap" mimeType="application/x-ms-xbap" />
<mimeMap fileExtension=".xbm" mimeType="image/x-xbitmap" />
<mimeMap fileExtension=".xdr" mimeType="text/plain" />
<mimeMap fileExtension=".xht" mimeType="application/xhtml+xml" />
<mimeMap fileExtension=".xhtml" mimeType="application/xhtml+xml" />
<mimeMap fileExtension=".xla" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xlam" mimeType="application/vnd.ms-excel.addin.macroEnabled.12" />
<mimeMap fileExtension=".xlc" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xlm" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xls" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xlsb" mimeType="application/vnd.ms-excel.sheet.binary.macroEnabled.12" />
<mimeMap fileExtension=".xlsm" mimeType="application/vnd.ms-excel.sheet.macroEnabled.12" />
<mimeMap fileExtension=".xlsx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" />
<mimeMap fileExtension=".xlt" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xltm" mimeType="application/vnd.ms-excel.template.macroEnabled.12" />
<mimeMap fileExtension=".xltx" mimeType="application/vnd.openxmlformats-officedocument.spreadsheetml.template" />
<mimeMap fileExtension=".xlw" mimeType="application/vnd.ms-excel" />
<mimeMap fileExtension=".xml" mimeType="text/xml" />
<mimeMap fileExtension=".xof" mimeType="x-world/x-vrml" />
<mimeMap fileExtension=".xpm" mimeType="image/x-xpixmap" />
<mimeMap fileExtension=".xps" mimeType="application/vnd.ms-xpsdocument" />
<mimeMap fileExtension=".xsd" mimeType="text/xml" />
<mimeMap fileExtension=".xsf" mimeType="text/xml" />
<mimeMap fileExtension=".xsl" mimeType="text/xml" />
<mimeMap fileExtension=".xslt" mimeType="text/xml" />
<mimeMap fileExtension=".xsn" mimeType="application/octet-stream" />
<mimeMap fileExtension=".xtp" mimeType="application/octet-stream" />
<mimeMap fileExtension=".xwd" mimeType="image/x-xwindowdump" />
<mimeMap fileExtension=".z" mimeType="application/x-compress" />
<mimeMap fileExtension=".zip" mimeType="application/x-zip-compressed" />
</staticContent>
<tracing>
<traceFailedRequests>
<add path="*">
<traceAreas>
<add provider="ASP" verbosity="Verbose" />
<add provider="ASPNET" areas="Infrastructure,Module,Page,AppServices" verbosity="Verbose" />
<add provider="ISAPI Extension" verbosity="Verbose" />
<add provider="WWW Server" areas="Authentication,Security,Filter,StaticFile,CGI,Compression,Cache,RequestNotifications,Module,Rewrite,WebSocket" verbosity="Verbose" />
</traceAreas>
<failureDefinitions statusCodes="200-999" />
</add>
</traceFailedRequests>
<traceProviderDefinitions>
<add name="WWW Server" guid="{3a2a4e84-4c21-4981-ae10-3fda0d9b0f83}">
<areas>
<clear />
<add name="Authentication" value="2" />
<add name="Security" value="4" />
<add name="Filter" value="8" />
<add name="StaticFile" value="16" />
<add name="CGI" value="32" />
<add name="Compression" value="64" />
<add name="Cache" value="128" />
<add name="RequestNotifications" value="256" />
<add name="Module" value="512" />
<add name="Rewrite" value="1024" />
<add name="FastCGI" value="4096" />
<add name="WebSocket" value="16384" />
<add name="ANCM" value="65536" />
</areas>
</add>
<add name="ASP" guid="{06b94d9a-b15e-456e-a4ef-37c984a2cb4b}">
<areas>
<clear />
</areas>
</add>
<add name="ISAPI Extension" guid="{a1c2040e-8840-4c31-ba11-9871031a19ea}">
<areas>
<clear />
</areas>
</add>
<add name="ASPNET" guid="{AFF081FE-0247-4275-9C4E-021F3DC1DA35}">
<areas>
<add name="Infrastructure" value="1" />
<add name="Module" value="2" />
<add name="Page" value="4" />
<add name="AppServices" value="8" />
</areas>
</add>
</traceProviderDefinitions>
</tracing>
<urlCompression />
<validation />
<webdav>
<globalSettings>
<propertyStores>
<add name="webdav_simple_prop" image="%IIS_BIN%\webdav_simple_prop.dll" image32="%IIS_BIN%\webdav_simple_prop.dll" />
</propertyStores>
<lockStores>
<add name="webdav_simple_lock" image="%IIS_BIN%\webdav_simple_lock.dll" image32="%IIS_BIN%\webdav_simple_lock.dll" />
</lockStores>
</globalSettings>
<authoring>
<locks enabled="true" lockStore="webdav_simple_lock" />
</authoring>
<authoringRules />
</webdav>
<webSocket />
<applicationInitialization />
</system.webServer>
<location path="" overrideMode="Allow">
<system.webServer>
<modules>
<add name="IsapiFilterModule" lockItem="true" />
<add name="BasicAuthenticationModule" lockItem="true" />
<add name="IsapiModule" lockItem="true" />
<add name="HttpLoggingModule" lockItem="true" />
<add name="DynamicCompressionModule" lockItem="true" />
<add name="StaticCompressionModule" lockItem="true" />
<add name="DefaultDocumentModule" lockItem="true" />
<add name="DirectoryListingModule" lockItem="true" />
<add name="ProtocolSupportModule" lockItem="true" />
<add name="HttpRedirectionModule" lockItem="true" />
<add name="ServerSideIncludeModule" lockItem="true" />
<add name="StaticFileModule" lockItem="true" />
<add name="AnonymousAuthenticationModule" lockItem="true" />
<add name="CertificateMappingAuthenticationModule" lockItem="true" />
<add name="UrlAuthorizationModule" lockItem="true" />
<add name="WindowsAuthenticationModule" lockItem="true" />
<add name="IISCertificateMappingAuthenticationModule" lockItem="true" />
<add name="WebMatrixSupportModule" lockItem="true" />
<add name="IpRestrictionModule" lockItem="true" />
<add name="DynamicIpRestrictionModule" lockItem="true" />
<add name="RequestFilteringModule" lockItem="true" />
<add name="CustomLoggingModule" lockItem="true" />
<add name="CustomErrorModule" lockItem="true" />
<add name="FailedRequestsTracingModule" lockItem="true" />
<add name="CgiModule" lockItem="true" />
<add name="FastCgiModule" lockItem="true" />
<!-- <add name="WebDAVModule" /> -->
<add name="RewriteModule" />
<add name="OutputCache" type="System.Web.Caching.OutputCacheModule" preCondition="managedHandler" />
<add name="Session" type="System.Web.SessionState.SessionStateModule" preCondition="managedHandler" />
<add name="WindowsAuthentication" type="System.Web.Security.WindowsAuthenticationModule" preCondition="managedHandler" />
<add name="FormsAuthentication" type="System.Web.Security.FormsAuthenticationModule" preCondition="managedHandler" />
<add name="DefaultAuthentication" type="System.Web.Security.DefaultAuthenticationModule" preCondition="managedHandler" />
<add name="RoleManager" type="System.Web.Security.RoleManagerModule" preCondition="managedHandler" />
<add name="UrlAuthorization" type="System.Web.Security.UrlAuthorizationModule" preCondition="managedHandler" />
<add name="FileAuthorization" type="System.Web.Security.FileAuthorizationModule" preCondition="managedHandler" />
<add name="AnonymousIdentification" type="System.Web.Security.AnonymousIdentificationModule" preCondition="managedHandler" />
<add name="Profile" type="System.Web.Profile.ProfileModule" preCondition="managedHandler" />
<add name="UrlMappingsModule" type="System.Web.UrlMappingsModule" preCondition="managedHandler" />
<add name="ApplicationInitializationModule" lockItem="true" />
<add name="WebSocketModule" lockItem="true" />
<add name="ServiceModel-4.0" type="System.ServiceModel.Activation.ServiceHttpModule,System.ServiceModel.Activation,Version=4.0.0.0,Culture=neutral,PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" />
<add name="ConfigurationValidationModule" lockItem="true" />
<add name="UrlRoutingModule-4.0" type="System.Web.Routing.UrlRoutingModule" preCondition="managedHandler,runtimeVersionv4.0" />
<add name="ScriptModule-4.0" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="managedHandler,runtimeVersionv4.0" />
<add name="ServiceModel" type="System.ServiceModel.Activation.HttpModule, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="managedHandler,runtimeVersionv2.0" />
<add name="AspNetCoreModuleV2" lockItem="true" />
</modules>
<handlers accessPolicy="Read, Script">
<!-- <add name="WebDAV" path="*" verb="PROPFIND,PROPPATCH,MKCOL,PUT,COPY,DELETE,MOVE,LOCK,UNLOCK" modules="WebDAVModule" resourceType="Unspecified" requireAccess="None" /> -->
<add name="AXD-ISAPI-4.0_64bit" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="PageHandlerFactory-ISAPI-4.0_64bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="SimpleHandlerFactory-ISAPI-4.0_64bit" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="WebServiceHandlerFactory-ISAPI-4.0_64bit" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-rem-ISAPI-4.0_64bit" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-soap-ISAPI-4.0_64bit" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="svc-ISAPI-4.0_64bit" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="rules-ISAPI-4.0_64bit" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="xoml-ISAPI-4.0_64bit" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="xamlx-ISAPI-4.0_64bit" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" />
<add name="aspq-ISAPI-4.0_64bit" path="*.aspq" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="cshtm-ISAPI-4.0_64bit" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="cshtml-ISAPI-4.0_64bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="vbhtm-ISAPI-4.0_64bit" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="vbhtml-ISAPI-4.0_64bit" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="svc-Integrated" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="svc-ISAPI-2.0" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="xoml-Integrated" path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="xoml-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="rules-Integrated" path="*.rules" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="rules-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" />
<add name="AXD-ISAPI-4.0_32bit" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="PageHandlerFactory-ISAPI-4.0_32bit" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="SimpleHandlerFactory-ISAPI-4.0_32bit" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="WebServiceHandlerFactory-ISAPI-4.0_32bit" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-rem-ISAPI-4.0_32bit" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-soap-ISAPI-4.0_32bit" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="svc-ISAPI-4.0_32bit" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="rules-ISAPI-4.0_32bit" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="xoml-ISAPI-4.0_32bit" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="xamlx-ISAPI-4.0_32bit" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" />
<add name="aspq-ISAPI-4.0_32bit" path="*.aspq" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="cshtm-ISAPI-4.0_32bit" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="cshtml-ISAPI-4.0_32bit" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="vbhtm-ISAPI-4.0_32bit" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="vbhtml-ISAPI-4.0_32bit" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="TraceHandler-Integrated-4.0" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="WebAdminHandler-Integrated-4.0" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="AssemblyResourceLoader-Integrated-4.0" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="PageHandlerFactory-Integrated-4.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="SimpleHandlerFactory-Integrated-4.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="WebServiceHandlerFactory-Integrated-4.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="HttpRemotingHandlerFactory-rem-Integrated-4.0" path="*.rem" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="HttpRemotingHandlerFactory-soap-Integrated-4.0" path="*.soap" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="svc-Integrated-4.0" path="*.svc" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="rules-Integrated-4.0" path="*.rules" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="xoml-Integrated-4.0" path="*.xoml" verb="*" type="System.ServiceModel.Activation.ServiceHttpHandlerFactory, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="xamlx-Integrated-4.0" path="*.xamlx" verb="GET,HEAD,POST,DEBUG" type="System.Xaml.Hosting.XamlHttpHandlerFactory, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="aspq-Integrated-4.0" path="*.aspq" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="cshtm-Integrated-4.0" path="*.cshtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="cshtml-Integrated-4.0" path="*.cshtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="vbhtm-Integrated-4.0" path="*.vbhtm" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="vbhtml-Integrated-4.0" path="*.vbhtml" verb="GET,HEAD,POST,DEBUG" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ScriptHandlerFactoryAppServices-Integrated-4.0" path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ScriptResourceIntegrated-4.0" path="*ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" preCondition="integratedMode,runtimeVersionv4.0" />
<add name="ASPClassic" path="*.asp" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" resourceType="File" />
<add name="SecurityCertificate" path="*.cer" verb="GET,HEAD,POST" modules="IsapiModule" scriptProcessor="%IIS_BIN%\asp.dll" resourceType="File" />
<add name="ISAPI-dll" path="*.dll" verb="*" modules="IsapiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
<add name="TraceHandler-Integrated" path="trace.axd" verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TraceHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="WebAdminHandler-Integrated" path="WebAdmin.axd" verb="GET,DEBUG" type="System.Web.Handlers.WebAdminHandler" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="AssemblyResourceLoader-Integrated" path="WebResource.axd" verb="GET,DEBUG" type="System.Web.Handlers.AssemblyResourceLoader" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="PageHandlerFactory-Integrated" path="*.aspx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.PageHandlerFactory" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="SimpleHandlerFactory-Integrated" path="*.ashx" verb="GET,HEAD,POST,DEBUG" type="System.Web.UI.SimpleHandlerFactory" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="WebServiceHandlerFactory-Integrated" path="*.asmx" verb="GET,HEAD,POST,DEBUG" type="System.Web.Services.Protocols.WebServiceHandlerFactory,System.Web.Services,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b03f5f7f11d50a3a" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="HttpRemotingHandlerFactory-rem-Integrated" path="*.rem" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,System.Runtime.Remoting,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="HttpRemotingHandlerFactory-soap-Integrated" path="*.soap" verb="GET,HEAD,POST,DEBUG" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory,System.Runtime.Remoting,Version=2.0.0.0,Culture=neutral,PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
<add name="AXD-ISAPI-2.0" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="PageHandlerFactory-ISAPI-2.0" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="SimpleHandlerFactory-ISAPI-2.0" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="WebServiceHandlerFactory-ISAPI-2.0" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-rem-ISAPI-2.0" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-soap-ISAPI-2.0" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness32" responseBufferLimit="0" />
<add name="svc-ISAPI-2.0-64" path="*.svc" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
<add name="AXD-ISAPI-2.0-64" path="*.axd" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="PageHandlerFactory-ISAPI-2.0-64" path="*.aspx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="SimpleHandlerFactory-ISAPI-2.0-64" path="*.ashx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="WebServiceHandlerFactory-ISAPI-2.0-64" path="*.asmx" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-rem-ISAPI-2.0-64" path="*.rem" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="HttpRemotingHandlerFactory-soap-ISAPI-2.0-64" path="*.soap" verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" responseBufferLimit="0" />
<add name="rules-64-ISAPI-2.0" path="*.rules" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
<add name="xoml-64-ISAPI-2.0" path="*.xoml" verb="*" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv2.0,bitness64" />
<add name="CGI-exe" path="*.exe" verb="*" modules="CgiModule" resourceType="File" requireAccess="Execute" allowPathInfo="true" />
<add name="SSINC-stm" path="*.stm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
<add name="SSINC-shtm" path="*.shtm" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
<add name="SSINC-shtml" path="*.shtml" verb="GET,HEAD,POST" modules="ServerSideIncludeModule" resourceType="File" />
<add name="TRACEVerbHandler" path="*" verb="TRACE" modules="ProtocolSupportModule" requireAccess="None" />
<add name="OPTIONSVerbHandler" path="*" verb="OPTIONS" modules="ProtocolSupportModule" requireAccess="None" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_32bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness32" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-ISAPI-4.0_64bit" path="*." verb="GET,HEAD,POST,DEBUG" modules="IsapiModule" scriptProcessor="%windir%\Microsoft.NET\Framework64\v4.0.30319\aspnet_isapi.dll" preCondition="classicMode,runtimeVersionv4.0,bitness64" responseBufferLimit="0" />
<add name="ExtensionlessUrlHandler-Integrated-4.0" path="*." verb="GET,HEAD,POST,DEBUG" type="System.Web.Handlers.TransferRequestHandler" preCondition="integratedMode,runtimeVersionv4.0" responseBufferLimit="0" />
<add name="StaticFile" path="*" verb="*" modules="StaticFileModule,DefaultDocumentModule,DirectoryListingModule" resourceType="Either" requireAccess="Read" />
</handlers>
</system.webServer>
</location>
</configuration>
@@ -0,0 +1,47 @@
# Contributing to 'socketlabs-php'
If you discover issues, have ideas for improvements or new features,
please report them to the [issue tracker](https://github.com/socketlabs/socketlabs-php/issues) of the repository or
submit a pull request. Please, try to follow these guidelines when you
do so.
- [Issue Reporting](#reporting)
- [Feature Requests](#feature)
- [Pull Requests](#pull)
## <a name="reporting"></a>Issue reporting
* Check that the issue has not already been reported.
* Check that the issue has not already been fixed in the latest code
(a.k.a. `main`).
* Be clear, concise and precise in your description of the problem.
* Open an issue with a descriptive title and a summary in grammatically correct,
complete sentences.
* Mention the version info.
## <a name="feature"></a> Want a Feature?
You can request a new feature by submitting an issue to our
[GitHub Repository](https://github.com/socketlabs/socketlabs-php). If you would like to implement a new feature then
consider what kind of change it is:
* **Major Changes** that you wish to contribute to the project should be
discussed first with `socketlabs-php` contributors in an issue or pull request so
that we can develop a proper solution and better coordinate our efforts,
prevent duplication of work, and help you to craft the change so that it is
successfully accepted into the project.
* **Small Changes** can be crafted and submitted to the
[GitHub Repository](https://github.com/socketlabs/socketlabs-php) as a Pull Request.
## <a name="pull"></a> Creating a Pull Request?
- Create a personal fork of the project on Github.
- If you created your fork a while ago be sure to pull upstream changes into your local repository.
- Create a new branch to work on! Branch from `main`.
- Implement/fix your feature, comment your code.
- Write or adapt tests as needed.
- Add or change the documentation as needed.
- Squash your commits into a single commit with git's [interactive rebase](https://help.github.com/articles/interactive-rebase). Create a new branch if necessary.
- Push your branch to your fork on Github, the remote `origin`.
- From your fork open a pull request with a clear title and description in grammatically correct, complete sentences.
@@ -0,0 +1,24 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\SocketLabsClient;
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
$message = new BasicMessage();
$message->subject = "Sending A Basic Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->replyTo = new EmailAddress("[email protected]");
//A basic message supports up to 50 recipients and supports several different ways to add recipients
$message->addToAddress("[email protected]"); //Add a To address by passing the email address
$message->addCcAddress("[email protected]", "Recipient #2"); //Add a CC address by passing the email address and a friendly name
$message->addBccAddress(new EmailAddress("[email protected]")); //Add a BCC address by passing an EmailAddress object
$response = $client->send($message);
@@ -0,0 +1,62 @@
<?php
include_once(__DIR__ . "../../includes.php");
use Socketlabs\SocketLabsClient;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\CustomHeader;
use Socketlabs\Message\Attachment;
use Socketlabs\Message\Metadata;
use Socketlabs\Message\BasicMessage;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
// $client->proxyUrl = exampleConfig::proxy(); //Uncomment to configure a proxy
// $client->endpoint = exampleConfig::endpoint() //Uncomment to configure a different endpoint address
//Build the message
$message = new BasicMessage();
$message->subject = "Sending Basic Complex Example";
//Add different types of parties to the message
$message->from = new EmailAddress("[email protected]", "from");
$message->to[] = new EmailAddress("[email protected]", "recipient name");
$message->cc[] = new EmailAddress("[email protected]", "cc name");
$message->bcc[] = new EmailAddress("[email protected]", "bcc name");
//Set reply to
$message->replyTo = new EmailAddress("[email protected]", "Reply Address");
//set html and text body parts
$message->htmlBody = "<body><p><strong>Lorem Ipsum</strong></p><br /><img src=\"cid:Bus\" /></body>";
$message->plainTextBody = "Lorem Ipsum";
$message->charset = "utf-8";
//Tag message with mailing and message ids.
//See https://support.socketlabs.com/index.php/Knowledgebase/Article/View/48/2/using-mailingcampaign-ids-and-message-ids-with-socketlabs-email-on-demand
$message->mailingId = "My Mailing Id"; //Identifier for groups of messages such as campaigns, jobs, or batches of messages.
$message->messageId = "My Message Id"; //Typically used to identify a specific message or a recipient of a message.
//Add custom headers to the message
$message->customHeaders = array(
"My-Header" => "1...2...3...",
"Example-Type" => "BasicWithCustomHeaders",
);
//Apply Metadata to the message
//There are several ways to add metadata to the message
$message->metadata = array(
"x-my-metadata-1" => "I am custom metadata example #1"
);
//OR
$message->metadata[] = new Metadata("x-my-metadata-2", "I am custom metadata example #2");
//OR
$message->addMetadata("x-my-metadata-3", "I am custom metadata example #3");
//Add tag to message
$message->tags[] = "Basic-Complex-Example-PHP";
//Add an attachment. specify the cid as 'Bus' so it can be embedded
$attachment = Attachment::createFromPath(__DIR__ . "/../Img/Bus.png", "Bus.png", "IMAGE/PNG", "Bus");
$attachment->customHeaders[] = new CustomHeader("MyAttachmentHeader", "I am an attachment header");
$message->attachments[] = $attachment;
$response = $client->send($message);
@@ -0,0 +1,23 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Simple Html file with text";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Get html content from a file
$pathToHtmlFile = __DIR__ .'../../../ExampleCode/Html/SampleEmail.html';
$message->htmlBody = file_get_contents($pathToHtmlFile);
//Send the message
$response = $client->send($message);
@@ -0,0 +1,36 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending a Message with ampBody support";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Pass in the htmlBody with ampBody support
$message->htmlBody = "<html><body><h1>Sending A Test Message</h1><p>This HTML will show if AMP is not supported.</p></body></html>";
$message->ampBody = "<!doctype html>" +
"<html amp4email>" +
"<head>" +
" <meta charset=\"utf-8\">" +
" <script async src=\"https://cdn.ampproject.org/v0.js\"></script>" +
" <style amp4email-boilerplate>body{visibility:hidden}</style>" +
" <style amp-custom>" +
" h1 {" +
" margin: 1rem;" +
" }" +
" </style>" +
"</head>" +
"<body>" +
" <h1>This is the AMP Html Body of my message</h1>" +
"</body>" +
"</html>";
$response = $client->send($message);
@@ -0,0 +1,20 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending Using a Template";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Pass in the ID of the template to use as the htmlBody
$message->apiTemplate = 1;
$response = $client->send($message);
@@ -0,0 +1,24 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending An ASCII Charset Email";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
$message->plainTextBody = "Lorem Ipsum";
//Set the character set
$message->charset = "ASCII";
//Use the character set (✔)
$message->htmlBody = "<body><strong>Lorem Ipsum</strong>Unicode: ✔ - Check</body>";
$response = $client->send($message);
@@ -0,0 +1,27 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Add attachment (with optional headers if desired)
$att = \Socketlabs\Message\Attachment::createFromPath( __DIR__ . "/../Img/Bus.png", "Bus.png", "IMAGE/PNG", "Bus");
$att->customHeaders = array(
"Color" => "Orange",
"Place" => "Beach",
);
$message->attachments[] = $att;
$response = $client->send($message);
@@ -0,0 +1,36 @@
<?php
include_once(__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending An Email With Custom Headers";
$message->htmlBody = "<body><strong>Lorem Ipsum</strong></body>";
$message->plainTextBody = "Lorem Ipsum";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Add custom headers to the message
//There are serveral ways to add custom fields to a message
$message->addCustomHeader("My-Header", "1...2...3...");
$message->addCustomHeader("Example-Type", "BasicWithCustomHeaders");
//OR
$message->customHeaders[] = new \Socketlabs\Message\CustomHeader("My-Header", "1...2...3...");
$message->customHeaders[] = new \Socketlabs\Message\CustomHeader("Example-Type", "BasicWithCustomHeaders");
//OR
$message->customHeaders = array(
"My-Header" => "1...2...3...",
"Example-Type" => "BasicWithCustomHeaders",
);
//Create the client and send the message
$response = $client->send($message);
@@ -0,0 +1,25 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\Attachment;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending an Email With An Embedded Image";
$message->plainTextBody = "Lorem Ipsum";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Add an image attachment
$message->attachments[] = Attachment::createFromPath( __DIR__."/../Img/Bus.png", "Bus.png", "IMAGE/PNG", "Bus");
//Display the attachment in the html body
$message->htmlBody = "<body><p><strong>Lorem Ipsum</strong></p><br /><img src=\"cid:Bus\" /></body>";
$response = $client->send($message);
@@ -0,0 +1,21 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
$client->proxyUrl = exampleConfig::proxy();
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message Through Proxy";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Send the message
$response = $client->send($message);
@@ -0,0 +1,25 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
$client->proxyUrl = exampleConfig::proxy();
$client->requestTimeout = 5;
$client->numberOfRetries = 2;
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message With Retry";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]", "Recipient #1"));
//Send the message
$response = $client->send($message);
@@ -0,0 +1,25 @@
<?php
include_once (__DIR__ . "../../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\Attachment;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->addToAddress(new EmailAddress("[email protected]"));
//Invalid attachment (empty stream)
$stream = fopen('data://text/plain;base64,' . base64_encode(""),'r');
$message->attachments[] = Attachment::createFromStream($stream, "Bus.png", "IMAGE/PNG", "Bus");
//Send message
$response = $client->send($message);
@@ -0,0 +1,22 @@
<?php
include_once (__DIR__ . "../../../includes.php");
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->addToAddress(new EmailAddress("[email protected]"));
//Invalid email address
$message->from = new EmailAddress("!@#$!@#$!@#$@#!$");
$response = $client->send($message);
@@ -0,0 +1,29 @@
<?php
include_once (__DIR__ . "../../../includes.php");
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\BasicMessage;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BasicMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
//Valid
$message->addToAddress(new EmailAddress("this@works"));
$message->addToAddress(new EmailAddress("[email protected]"));
//Invalid
$message->addToAddress(new EmailAddress("!@#$!@#$!@#$@#!$"));
$message->addToAddress(new EmailAddress("failure.com"));
$message->addToAddress(new EmailAddress("ImMissingSomethin"));
$message->addToAddress(new EmailAddress("Fail@@!.Me"));
$response = $client->send($message);
@@ -0,0 +1,25 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
$message->subject = "Sending A Test Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new BulkRecipient("[email protected]");
$message->replyTo = new BulkRecipient("[email protected]");
//Add Bulk Recipients
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #1"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #2"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #3"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #4"));
$response = $client->send($message);
@@ -0,0 +1,86 @@
<?php
include_once(__DIR__ . "../../includes.php");
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\CustomHeader;
use Socketlabs\Message\Attachment;
use Socketlabs\Message\Metadata;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
//Add some global merge-data (These will be applied to all Recipients unless specifically overridden by Recipient level merge-data)
$message->addGlobalMergeData("Motto", "When hitting the Inbox matters!");
$message->addGlobalMergeData("Birthday", "Unknown");
$message->addGlobalMergeData("Age", "an unknown number of");
$message->addGlobalMergeData("UpSell", "BTW: You are eligible for discount pricing when you upgrade your service!");
//Add recipients with merge data
$recipient1 = new BulkRecipient("[email protected]");
$recipient1->addMergeData("Birthday", "08/05/1991");
$recipient1->addMergeData("Age", "27");
$message->addToAddress($recipient1);
$recipient2 = new BulkRecipient("[email protected]");
$recipient2->addMergeData("Birthday", "04/12/1984");
$recipient2->addMergeData("Age", "34");
$recipient2->addMergeData("UpSell", ""); // This will override the Global Merge-Data for this specific Recipient
$message->addToAddress($recipient2);
$recipient3 = new BulkRecipient("[email protected]", "Recipient 3"); // The merge-data for this Recipient will be populated with Global Merge-Data
$message->addToAddress($recipient3);
//Set other properties as needed
$message->subject = "Complex BulkSend Example";
$message->from = new EmailAddress("[email protected]", "FromMe");
$message->replyTo = new EmailAddress("[email protected]");
//Apply Custom Headers to the message
$message->customHeaders[] = new CustomHeader("testMessageHeader", "I am a message header");
//Apply Metadata to the message
$message->metadata[] = new Metadata("x-mycustommetadata", "I am custom metadata");
//Add tag to message
$message->tags[] = "Basic-Complex-Example-PHP";
//Build the Content (Note the %% symbols used to denote the data to be merged)
$message->htmlBody = "<html>" .
"<head><title>Complex</title></head>" .
"<body>" .
"<h1>Merged Data</h1>" .
"<p>" .
"Motto = <b>%%Motto%%</b> </br>" .
"Birthday = <b>%%Birthday%%</b> </br>" .
"Age = <b>%%Age%%</b> </br>" .
"UpSell = <b>%%UpSell%%</b> </br>" .
"</p>" .
"</br>" .
"<h1>Example of Merge Usage</h1>" .
"<p>" .
"Our company motto is '<b>%%Motto%%</b>'. </br>" .
"Your birthday is <b>%%Birthday%%</b> and you are <b>%%Age%%</b> years old. </br>" .
"</br>" .
"<b>%%UpSell%%<b>" .
"</p>" .
"</body>" .
"</html>";
$message->plainTextBody = "Global Merge Data" .
"CompanyMotto = %%Motto%%" .
" " .
"Per Recipient Merge Data" .
" EyeColor = %%EyeColor%%" .
" HairColor = %%HairColor%%";
//Add an attachment (with a Custom Header)
$att = Attachment::createFromPath(__DIR__ . "/../Img/Bus.png", "Bus.png", "IMAGE/PNG", "Bus");
$att->customHeaders = array("Attachment-Header" => "I Am A Bus");
$message->attachments[] = $att;
$response = $client->send($message);
@@ -0,0 +1,49 @@
<?php
include_once (__DIR__ . "../../includes.php");
include_once (__DIR__ . "../../DataSource\Customer.php");
include_once (__DIR__ . "../../DataSource\CustomerRepository.php");
use Socketlabs\Message\BulkRecipient;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\BulkMessage;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
$message->subject = "Hello %%FirstName%%";
$message->from = new EmailAddress("[email protected]");
$message->ReplyTo = new EmailAddress("[email protected]");
$message->htmlBody = "<html>" .
"<head><title>Data Source Merge Data Example</title></head>" .
"<body>" .
"<h1>Sending A Test Message With Merge Data From Datasource</h1>" .
"<h2>Hello %%FirstName%% %%LastName%%.</h2>" .
"<p>Is your favorite color still %%FavoriteColor%%?</p>" .
"</body>" .
"</html>";
$message->plainTextBody = "Sending A Test Message With Merge Data From Datasource" .
" Hello %%FirstName%% %%LastName%%. Is your favorite color still %%FavoriteColor%%?";
// Retrieve data from the datasource
$repo = new CustomerRepository();
$customers = $repo->GetData();
// Merge in the customers from the datasource
foreach($customers as $customer){
$recipient = new BulkRecipient($customer->email);
$recipient->addMergeData("FirstName", $customer->firstName);
$recipient->addMergeData("LastName", $customer->lastName);
$recipient->addMergeData("FavoriteColor", $customer->favoriteColor);
$message->addToAddress($recipient);
}
$response = $client->send($message);
@@ -0,0 +1,40 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
$message->subject = "Sending A Bulk Message with ampBody";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->ampBody = "<!doctype html>" +
"<html amp4email>" +
"<head>" +
" <meta charset=\"utf-8\">" +
" <script async src=\"https://cdn.ampproject.org/v0.js\"></script>" +
" <style amp4email-boilerplate>body{visibility:hidden}</style>" +
" <style amp-custom>" +
" h1 {" +
" margin: 1rem;" +
" }" +
" </style>" +
"</head>" +
"<body>" +
" <h1>This is the AMP Html Body of the message</h1>" +
"</body>" +
"</html>";
$message->from = new BulkRecipient("[email protected]");
$message->replyTo = new BulkRecipient("[email protected]");
//Add Bulk Recipients
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #1"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #2"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #3"));
$message->addToAddress (new BulkRecipient("[email protected]", "Recipient #4"));
$response = $client->send($message);
@@ -0,0 +1,45 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
$message->subject = "Sending A Test Message";
$message->from = new BulkRecipient("[email protected]");
//Set the content to use MergeData
$message->htmlBody = "<html>" .
"<head><title>ASCII Merge Data Example</title></head>" .
"<body>" .
"<h1>Merge Data</h1>" .
"<p>Complete? = %%Complete%%</p>" .
"</body>" .
"</html>";
$message->plainTextBody = "Merge Data Complete? = %%Complete%%";
//Set the character set
$message->charset = "ASCII";
//Create recipients with MergeData that uses the character set (✔, ✘)
$recipient1 = new BulkRecipient("[email protected]", "Recipient #1");
$recipient1->addMergeData("Complete", "✔");
$recipient2 = new BulkRecipient("[email protected]", "Recipient #2");
$recipient2->addMergeData("Complete", "✔");
$recipient3 = new BulkRecipient("[email protected]");
$recipient3->addMergeData("Complete", "✘");
//Add the recipients to the message
$message->addToAddress($recipient1);
$message->addToAddress($recipient2);
$message->addToAddress($recipient3);
//Create the client and send the message
$response = $client->send($message);
@@ -0,0 +1,57 @@
<?php
include_once (__DIR__ . "../../includes.php");
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\EmailAddress;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(exampleConfig::serverId(), exampleConfig::password());
//Build the message
$message = new BulkMessage();
$message->subject = "Sending A BulkSend with MergeData";
$message->from = new EmailAddress("[email protected]");
//Build the Content (Note the %% symbols used to denote the data to be merged)
$message->htmlBody = "<html>" .
"<head><title>Merge Data Example</title></head>" .
"<body>" .
"<h1>Global Merge Data</h1>" .
"<p>CompanyMotto = %%Motto%%</p>" .
"<h1>Per Recipient Merge Data</h1>" .
"<p>EyeColor = %%EyeColor%%</p>" .
"<p>HairColor = %%HairColor%%</p>" .
"</body>" .
"</html>";
$message->plainTextBody = "Global Merge Data " .
"CompanyMotto = %%Motto%%" .
" " .
"Per Recipient Merge Data" .
" EyeColor = %%EyeColor%%" .
" HairColor = %%HairColor%%";
//Add some global merge data
$message->addGlobalMergeData("Motto", "When hitting the Inbox matters!");
//Add recipients with merge data
$recipient1 = new BulkRecipient("[email protected]", "Recipient #1");
$recipient1->addMergeData("EyeColor", "Blue");
$recipient1->addMergeData("HairColor", "Blond");
$recipient2 = new BulkRecipient("[email protected]", "Recipient #2");
$recipient1->addMergeData("EyeColor", "Green");
$recipient1->addMergeData("HairColor", "Brown");
$recipient3 = new BulkRecipient("[email protected]", "Recipient #3");
$recipient1->addMergeData("EyeColor", "Hazel");
$recipient1->addMergeData("HairColor", "Black");
//Add the recipients to the message
$message->addToAddress($recipient1);
$message->addToAddress($recipient2);
$message->addToAddress($recipient3);
//Create the client and send the message
$response = $client->send($message);
@@ -0,0 +1,21 @@
<?php
class Customer{
public $firstName;
public $lastName;
public $email;
public $favoriteColor;
public function __construct($firstName, $lastName, $email, $favoriteColor){
$this->firstName = $firstName;
$this->lastName = $lastName;
$this->email = $email;
$this->favoriteColor = $favoriteColor;
}
}
@@ -0,0 +1,22 @@
<?php
//root path relative to this include
include_once (__DIR__ . "../../DataSource\Customer.php");
class CustomerRepository{
public function GetData(){
$customer1 = new Customer("Recipient", "One", "[email protected]", "Green");
$customer2 = new Customer("Recipient", "Two", "[email protected]", "Red");
$customer3 = new Customer("Recipient", "Three", "[email protected]", "Blue");
$customer4 = new Customer("Recipient", "Four", "[email protected]", "Orange");
$results = array();
array_push($results, $customer1, $customer2, $customer3, $customer4);
return $results;
}
}
@@ -0,0 +1,28 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
<title>Lorem Ipsum</title>
</head>
<body>
<div>
<h1>Lorem Ipsum</h1>
<h2>The standard Lorem Ipsum passage, used since the 1500s</h2>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex
ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate
velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id
est laborum.
</p>
<ol>
<li>Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
<li>Aliquam tincidunt mauris eu risus.</li>
<li>Vestibulum auctor dapibus neque.</li>
</ol>
</div>
</body>
</html>
Binary file not shown.

After

Width:  |  Height:  |  Size: 487 KiB

@@ -0,0 +1,7 @@
<?php
//root path relative to this include
$rootPath = __DIR__ . "../../../../";
include_once ($rootPath . "InjectionApi/src/includes.php");
include_once ($rootPath . "InjectionApi/Examples/ExampleCode/exampleConfig.php");
@@ -0,0 +1,24 @@
<?php
class exampleConfig{
public function __construct(){
}
public static function serverId(){
return getenv('SOCKETLABS_SERVER_ID');
}
public static function password(){
return getenv('SOCKETLABS_INJECTION_API_KEY', true) ?: getenv('SOCKETLABS_INJECTION_API_KEY');
}
public static function proxy() {
return "http://127.0.0.1:4433";
}
public static function endpoint() {
return "https://inject.socketlabs.com/api/v1/email";
}
}
@@ -0,0 +1,110 @@
<!DOCTYPE html>
<html lang="en-ca">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!-- CDN support for Bootstrap -->
<script src = "https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap-theme.min.css" integrity="sha384-rHyoN1iRsVXV4nD0JutlnGaslCJuC7uwjduW9SVrLvRYooPp2bWYgmgJQIXwl/Sp" crossorigin="anonymous">
<!-- local css -->
<link rel="stylesheet" href="Index/CSS/Index.css" type="text/css">
<!-- Javascript for site -->
<script src = "Index/Js/Index.js"></script>
<title>HOME</title>
</head>
<body>
<div class="outer">
<header>
<div class="container-fluid"> <!-- If Needed Left and Right Padding in 'md' and 'lg' screen means use container class -->
<div class="row">
<div class="col-xs-2">
<img class="logo" src="index/img/socketlabs-logo.png" alt="MyCompany Logo">
</div>
<div class="col-xs-8 text-center">
<h1>PHP SDK Example Runner</h1>
</div>
<div class="col-xs-2"></div>
</div>
<hr>
<div class="row">
<div class="col-xs-12">
Select one of the following examples to see the Example Code, Message Values, and the Request/Response JSON:
</div>
</div>
<br>
</div>
<div class="container-fluid">
<div class="row">
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<h4>Basic Send Examples</h4>
<nav>
<ul>
<li><a href="" onclick="getExample('Basic/Basic.php'); return false;">Basic Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicFromHtmlFile.php'); return false;">Basic Send From Html File</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithApiTemplate.php'); return false;">Basic Send API Template Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithAsciiCharset.php'); return false;">Basic Send Ascii Charset Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithAttachment.php'); return false;">Basic Send Attachment Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithCustomHeaders.php'); return false;">Basic Send Custom Headers Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithEmbeddedImage.php'); return false;">Basic Send Embedded Image Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicComplexExample.php'); return false;">Basic Send Complex Example</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithProxy.php'); return false;">Basic Send Using a Proxy</a></li>
<li><a href="" onclick="getExample('Basic/BasicWithRetry.php'); return false;">Basic Send With Retry</a></li>
</ul>
</nav>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<h4>Bulk Send Examples</h4>
<nav>
<ul>
<li><a href="" onclick="getExample('Bulk/Bulk.php'); return false;">Bulk Example</a></li>
<li><a href="" onclick="getExample('Bulk/BulkFromDataSourceWithMerge.php'); return false;">Bulk Send from Datasource with Merge Example</a></li>
<li><a href="" onclick="getExample('Bulk/BulkComplexExample.php'); return false;">Bulk Send Complex Example</a></li>
<li><a href="" onclick="getExample('Bulk/BulkWithAsciiCharsetMergeData.php'); return false;">Bulk Send Ascii Charset Merge Example</a></li>
<li><a href="" onclick="getExample('Bulk/BulkWithMergeData.php'); return false;">Bulk Send Merge Data Example</a></li>
</ul>
</nav>
</div>
<div class="col-xs-4 col-sm-4 col-md-4 col-lg-4">
<h4>Validation Error Handling Examples</h4>
<nav>
<ul>
<li><a href="" onclick="getExample('Basic/Invalid/BasicWithInvalidAttachment.php'); return false;">Basic Send With Invalid Attachment Example</a></li>
<li><a href="" onclick="getExample('Basic/Invalid/BasicWithInvalidFrom.php'); return false;">Basic Send With Invalid From Example</a></li>
<li><a href="" onclick="getExample('Basic/Invalid/BasicWithInvalidRecipients.php'); return false;">Basic Send With Invalid Recipients Example</a></li>
</ul>
</nav>
</div>
</div>
</div>
</header>
<main>
<div>
<div id="output" class="tabs hidden">
<input name="tabs" type="radio" id="tab-1" checked="checked" class="input"/>
<label for="tab-1" class="label">Example Code</label>
<div id="codeExample" class="panel"></div>
<input name="tabs" type="radio" id="tab-2" class="input"/>
<label for="tab-2" class="label">Response JSON</label>
<div id="responseJson" class="panel"><textarea></textarea></div>
<input name="tabs" type="radio" id="tab-3" class="input"/>
<label for="tab-3" class="label">Request JSON</label>
<div id="requestJson" class="panel"><textarea></textarea></div>
</div>
</div>
</main>
</div>
</body>
</html>
@@ -0,0 +1,97 @@
var getExample = function(fileNameOfExample) {
$('#output').removeClass( "hidden" );
$("#responseJson>textarea").empty();
$("#requestJson>textarea").empty();
displayExampleCode(fileNameOfExample);
displayData(fileNameOfExample);
}
var displayData = function(fileNameOfExample) {
$.ajax({
url: '../Examples/Index/PHP/RunExampleCode.php',
type: 'POST',
datatype: "json",
data: {
fileNameOfExample : fileNameOfExample
},
success: function(data) {
// // tab1 - Example Code
// var exCode = data[0];
// // remove all carriage returns so the <pre> tags work properly
// exCode = exCode.replace(/[\n\r]/g, '');
// document.getElementById("codeExample").innerHTML = '<pre>' + exCode + '</pre>';
// // tab2 - Response JSON
// var respJson = data[3];
// document.getElementById("responseJson").innerHTML = '<pre>' + respJson + '</pre>';
var response = data.response
var respJson = JSON.stringify(response, null, 2);
$("#responseJson>textarea").html(respJson);
// document.getElementById("responseJson").innerHTML = '<pre>' + respJson + '</pre>';
// // tab3 - Request JSON
var request = data.request
var reqJson = JSON.stringify(request, null, 2);
$("#requestJson>textarea").html(reqJson);
// document.getElementById("requestJson").innerHTML = '<pre>' + reqJson + '</pre>';
// //tab4 - Message Values
// var varValues = data[1];
// // get rid of the path/file name in the output since we don't need to display it
// variableValues = variableValues.replace(/<small>[\s\S]*?<\/small>/, '<small>' + '' + '<\/small>');
// document.getElementById("variableValues").innerHTML = varValues; // <pre> tags are already added by php
},
error: function (jqXHR, exception) {
alert("error: " + jqXHR.status);
alert("error: " + jqXHR.responseText);
alert("error: " + exception);
}
});
};
var displayExampleCode = function(fileNameOfExample) {
$.ajax({
url: '../Examples/Index/PHP/DisplayExampleCode.php',
type: 'POST',
contentype: "text/html; charset=UTF-8",
datatype: "html",
data: {
fileNameOfExample : fileNameOfExample
},
success: function(data) {
data = data.replace(/[\n\r]/g, ''); // remove all carriage returns so the <pre> tags work properly
document.getElementById("codeExample").innerHTML = '<pre>' + data + '</pre>';
},
error: function (jqXHR, exception) {
alert("error: " + jqXHR.status);
alert("error: " + jqXHR.responseText);
alert("error: " + exception);
}
});
};
var displayVariableValues = function(fileNameOfExample) {
$.ajax({
url: '../Examples/Index/PHP/DisplayVariableValues.php',
type: 'POST',
contentype: "text/html; charset=UTF-8",
datatype: "html",
data: {
fileNameOfExample : fileNameOfExample
},
success: function(data) {
// get rid of the path/file name in the output since we don't need to display it
data = data.replace(/<small>[\s\S]*?<\/small>/, '<small>' + '' + '<\/small>');
document.getElementById("variableValues").innerHTML = data; // <pre> tags are already added by php
},
error: function (jqXHR, exception) {
alert("error: " + jqXHR.status);
alert("error: " + jqXHR.responseText);
alert("error: " + exception);
}
});
};
@@ -0,0 +1,19 @@
<?php
if(!defined('SOCKETLABS_INJECTION_API_SAMPLE_ROOT_PATH'))
define('SOCKETLABS_INJECTION_API_SAMPLE_ROOT_PATH', dirname(__DIR__) . '/');
// check for parameter
if (isset($_POST['fileNameOfExample'])) {
runExample($_POST['fileNameOfExample']);
}
function runExample($fileNameOfExample){
$exampleCodePath= "../../ExampleCode/$fileNameOfExample";
$source = show_source($exampleCodePath);
return $source;
}
?>
@@ -0,0 +1,25 @@
<?php
if(!defined('SOCKETLABS_INJECTION_API_SAMPLE_ROOT_PATH'))
define('SOCKETLABS_INJECTION_API_SAMPLE_ROOT_PATH', dirname(__DIR__) . '/');
// check for parameter
if (isset($_POST['fileNameOfExample'])) {
runExample($_POST['fileNameOfExample']);
}
function runExample($fileNameOfExample){
$exampleCodePath= "../../ExampleCode/$fileNameOfExample";
include $exampleCodePath;
$factory = new \Socketlabs\Core\InjectionRequestFactory(exampleConfig::serverId(), exampleConfig::password());
$request = $factory->generateRequest($message);
$response->responseMessage = $response->responseMessage;
$output = array("request"=>$request, "response"=>$response);
header('Content-Type: application/json');
echo json_encode($output);
}
?>
@@ -0,0 +1,88 @@
.logo {
height: auto;
width: 210px;
padding-top: 14px
}
hr {
display: block;
margin-top: 0.1em;
margin-bottom: 0.5em;
margin-left: auto;
margin-right: auto;
border-style: inset;
border-width: 1px;
}
main {
padding: 10px;
}
.tabs {
display: flex;
flex-wrap: wrap;
}
.input {
position: absolute;
opacity: 0;
}
.label {
width: 100%;
padding: 10px 20px;
margin-right: 1px;
cursor: pointer;
font-weight: bold;
font-size: 18px;
color: #7f7f7f;
border-top-style: solid;
border-right-style: solid;
border-left-style: solid;
border-width: 1px;
border-color: #ccc;
}
.label:hover {
background: #d8d8d8;
}
.label:active {
background: #ccc;
}
.input:checked + .label {
background: #f5f5f5;
color: #000;
}
@media (min-width: 600px) {
.label {
width: auto;
}
}
.panel {
display: none;
width: 100%;
margin-top: -5px;
}
@media (min-width: 600px) {
.panel {
order: 99;
}
}
.input:checked + .label + .panel {
display: block;
}
textarea{
min-width: 100%;
max-width: 100%;
resize: none;
height: 400px;
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

@@ -0,0 +1,22 @@
<?php
namespace Socketlabs;
/**
* The result of a single recipient in the Injection request.
*/
class AddressResult{
/**
* The recipient's email address.
*/
public $emailAddress;
/**
* Whether the recipient was accepted for delivery.
*/
public $accepted;
/**
* An error code detailing why the recipient was not accepted.
*/
public $errorCode;
}
@@ -0,0 +1,46 @@
<?php
namespace Socketlabs\Core;
/**
* A code describing the result of an attempt to parse an Api key.
*/
abstract class ApiKeyParseResult
{
/// <summary>
/// No result could be produced.
/// </summary>
const None = "None";
/// <summary>
/// The key was found to be the improper length.
/// </summary>
const InvalidKeyLength = "InvalidKeyLength";
/// <summary>
/// The key was found to be blank or invalid.
/// </summary>
const InvalidEmptyOrWhitespace = "InvalidEmptyOrWhitespace";
/// <summary>
/// The key was found to be blank or invalid.
/// </summary>
const Invalid = "Invalid";
/// <summary>
/// The public portion of the key was unable to be parsed.
/// </summary>
const InvalidUnableToExtractPublicPart = "InvalidUnableToExtractPublicPart";
/// <summary>
/// The secret portion of the key was unable to be parsed.
/// </summary>
const InvalidUnableToExtractSecretPart = "InvalidUnableToExtractSecretPart";
/// <summary>
/// The public portion of the key has an invalid length.
/// </summary>
const InvalidPublicPartLength = "InvalidPublicPartLength";
/// <summary>
/// The secret portion of the key has an invalid length.
/// </summary>
const InvalidSecretPartLength = "InvalidSecretPartLength";
/// <summary>
/// Key was successfully parsed.
/// </summary>
const Success = "Success";
}
@@ -0,0 +1,61 @@
<?php
namespace Socketlabs\Core;
/**
* Contains the method for parsing the Api Key.
*/
class ApiKeyParser {
/** Parse the API key to determine what kind of key was provided
. */
public function parse($wholeApiKey)
{
if ($wholeApiKey == null || trim($wholeApiKey) == '')
{
$result = ApiKeyParseResult::InvalidEmptyOrWhitespace;
return $result;
}
if (strlen($wholeApiKey) !== 61)
{
$result = ApiKeyParseResult::InvalidKeyLength;
return $result;
}
$splitPosition = strpos($wholeApiKey, '.');
if ($splitPosition === false)
{
$result = ApiKeyParseResult::Invalid;
return $result;
}
//extract the public part
$maxCount = min(50, strlen($wholeApiKey));
if ($splitPosition === false)
{
$result = ApiKeyParseResult::InvalidUnableToExtractPublicPart;
return $result;
}
$publicPart = substr($wholeApiKey,0, $splitPosition);
if (strlen($publicPart) !== 20)
{
$result = ApiKeyParseResult::InvalidPublicPartLength;
return $result;
}
$privatePart = substr($wholeApiKey, ($splitPosition + 1), strlen($wholeApiKey));
if (strlen($privatePart) !== 40)
{
$result = ApiKeyParseResult::InvalidSecretPartLength;
return $result;
}
$result = ApiKeyParseResult::Success;
return $result;
}
}
@@ -0,0 +1,38 @@
<?php
namespace Socketlabs\Core;
/**
* Represents a injection request for sending to the Injection Api.
*/
class InjectionRequest
{
/**
* list of messages to be sent.
*/
public $Messages;
/**
* Your SocketLabs ServerId number.
*/
public $ServerId;
/**
* Your SocketLabs Injection API key.
*/
public $ApiKey;
/**
* Creates a new instance of the InjectionRequest class.
* @param serverId
* @param apiKey
*/
public function __construct($serverId, $apiKey)
{
$this->ServerId = (int)$serverId;
$this->ApiKey = $apiKey;
$this->Messages = array();
}
}
@@ -0,0 +1,280 @@
<?php
namespace Socketlabs\Core;
/**
* Used by the Send function of the SocketLabsClient to generate an InjectionRequest for the Injection Api
*/
class InjectionRequestFactory
{
private $serverId;
private $apiKey;
/**
* Creates a new instance of the InjectionRequestFactory.
* @param number $serverId
* @param string $apiKey
*/
public function __construct($serverId, $apiKey)
{
$this->serverId = $serverId;
$this->apiKey = $apiKey;
}
/**
* Generate request setting properties.
* @param object $message
* @return object
*/
public function generateRequest($message)
{
if (is_a($message, "Socketlabs\Message\BulkMessage")) {
return $this->generateBulkRequest($message);
}
return $this->generateBasicRequest($message);
}
/**
* Generate request setting properties common to both message types.
* @param object $message
* @return object
*/
private function generateRequestCore($message)
{
$request = new InjectionRequest($this->serverId, $this->apiKey);
$messageJson = new \Socketlabs\Core\Serialization\MessageJson();
$messageJson->Subject = $message->subject;
$messageJson->TextBody = $message->plainTextBody;
$messageJson->HtmlBody = $message->htmlBody;
$messageJson->MailingId = $message->mailingId;
$messageJson->MessageId = $message->messageId;
$messageJson->CharSet = $message->charset;
$messageJson->ApiTemplate = $message->apiTemplate;
$messageJson->Tags = $message->tags == null ? null : $message->tags;
//set attachments
$messageJson->Attachments = $this->getAttachments($message->attachments);
//set custom headers
$messageJson->CustomHeaders = $this->getCustomHeaders($message->customHeaders);
//set metadata
$messageJson->Metadata = $this->getMetadata($message->metadata);
//set from address
$messageJson->From = new \Socketlabs\Core\Serialization\AddressJson($message->from->emailAddress, $message->from->friendlyName);
//reply-to is optional, if provided, set it
if ($message->replyTo != null)
$messageJson->ReplyTo = new \Socketlabs\Core\Serialization\AddressJson($message->replyTo->emailAddress, $message->replyTo->friendlyName);
//append message to messages collection. there should only be one
$request->Messages[] = $messageJson;
return $request;
}
/**
* Generate request representing a basic message
* @param BasicMessage $basicMessage
* @return object
*/
private function generateBasicRequest($basicMessage)
{
//populate properties common to all messages
$request = $this->generateRequestCore($basicMessage);
$messageJson = $request->Messages[0];
//populate To, Cc, Bcc collections
$messageJson->To = $this->getAddressList($basicMessage->to);
$messageJson->Cc = $this->getAddressList($basicMessage->cc);
$messageJson->Bcc = $this->getAddressList($basicMessage->bcc);
//this is important. if PerMessage is set, the api will process this as a bulk style message.
//$messageJson->MergeData->PerMessage = null;
unset($messageJson->MergeData);
return $request;
}
/**
* Generate request representing a bulk message
* @param object $bulkMessage
* @return object
*/
private function generateBulkRequest($bulkMessage)
{
//populate properties common to all messages
$request = $this->generateRequestCore($bulkMessage);
$messageJson = $request->Messages[0];
//magic recipient & friendly name used when sending bulk style
$messageJson->To = array(new \Socketlabs\Core\Serialization\AddressJson("%%DeliveryAddress%%", "%%Recipient Name%%"));
//recipients and merge fields are all sent as merge data
$messageJson->MergeData->PerMessage = $this->getBulkMergeFields($bulkMessage->to);
//Add global merge data. This is used only in bulk-style messages
$messageJson->MergeData->Global = $this->getGlobalMergeFields($bulkMessage->global);
return $request;
}
/**
* Shapes list of email addresses into injection api format
* @param EmailAddress $emailAddress
* @return object
*/
private function getAddressList($emailAddresses)
{
if ($emailAddresses == null)
return null;
$results = array();
foreach ($emailAddresses as $emailAddress) {
$results[] = new \Socketlabs\Core\Serialization\AddressJson($emailAddress->emailAddress, $emailAddress->friendlyName);
}
return $results;
}
/**
* Helper function to map array of Attachmets to array of AttachmentsJson
* @param array $attachment
* @return array
*/
private function getAttachments($attachments)
{
if ($attachments == null)
return null;
$results = array();
foreach ($attachments as $attachment) {
$target = new \Socketlabs\Core\Serialization\AttachmentJson();
$target->Name = $attachment->name;
$target->ContentType = $attachment->mimeType;
$target->ContentId = $attachment->contentId;
$target->Content = base64_encode($attachment->content);
//map custom headers
$target->CustomHeaders = $this->getCustomHeaders($attachment->customHeaders);
$results[] = $target;
}
return $results;
}
/**
* Helper function to map array of CustomHeader to CustomHeaderJson
* @param array $customHeader
* @return array
*/
private function getCustomHeaders($customHeaders)
{
if ($customHeaders == null) return null;
$results = array();
while ($customHeader = current($customHeaders)) {
if (is_a($customHeader, "\Socketlabs\Message\CustomHeader")) {
$results[] = new \Socketlabs\Core\Serialization\CustomHeadersJson($customHeader->name, $customHeader->value);
} else {
$key = key($customHeaders);
$results[] = new \Socketlabs\Core\Serialization\CustomHeadersJson($key, $customHeader);
}
next($customHeaders);
}
return $results;
}
/**
* Helper function to map array of Metadata to MetadataJson
* @param array $arr
* @return array
*/
private function getMetadata($arr)
{
if ($arr == null) return null;
$results = array();
while ($metadata = current($arr)) {
if (is_a($metadata, "\Socketlabs\Message\Metadata")) {
$results[] = new \Socketlabs\Core\Serialization\MetadataJson($metadata->key, $metadata->value);
} else {
$key = key($arr);
$results[] = new \Socketlabs\Core\Serialization\MetadataJson($key, $metadata);
}
next($arr);
}
return $results;
}
/**
* Shape bulk recipients and their merge data into the format needed for the injection api
* @param object $bulkRecipients
* @return array
*/
private function getBulkMergeFields($bulkRecipients)
{
$allRecipients = array();
//loop through each recipient
foreach ($bulkRecipients as $bulkRecipient) {
//add address
$recipientMergeFields = array();
$recipientMergeFields[] = new \Socketlabs\Core\Serialization\MergeFieldJson("DeliveryAddress", $bulkRecipient->emailAddress);
//add friendly name if provided
if ($bulkRecipient->friendlyName != null)
$recipientMergeFields[] = new \Socketlabs\Core\Serialization\MergeFieldJson('RecipientName', $bulkRecipient->friendlyName);
//if merge fields provided, add them as well
if ($bulkRecipient->mergeData != null) {
foreach ($bulkRecipient->mergeData as $mergeData) {
$recipientMergeFields[] = new \Socketlabs\Core\Serialization\MergeFieldJson($mergeData->Name, $mergeData->Value);
}
}
//add recipient merge data to the results
array_push($allRecipients, $recipientMergeFields);
}
return $allRecipients;
}
/**
* Shape global merge fields into format needed for the injection api
* @param object $globalMergeData merge data array
* @return array
*/
private function getGlobalMergeFields($globalMergeData)
{
if ($globalMergeData == null)
return null;
$results = array();
foreach ($globalMergeData as $mergeData) {
$results[] = new \Socketlabs\Core\Serialization\MergeFieldJson($mergeData->Name, $mergeData->Value);
}
return $results;
}
}
@@ -0,0 +1,102 @@
<?php
namespace Socketlabs\Core;
/**
* Used by the SocketLabsClient to convert the response form the Injection API.
*/
class InjectionResponseParser{
/**
* Parse the response from theInjection Api into SendResponse
* @param $response
* @param $responseHeader
* @return \Socketlabs\SendResponse
*/
public static function parse($response, $responseHeader){
if($response){
$injectionResponse = json_decode($response);
$sendResult = InjectionResponseParser::DetermineSendResult($injectionResponse, $responseHeader);
$newResponse = new \Socketlabs\SendResponse($sendResult);
$newResponse->transactionReceipt = $injectionResponse->TransactionReceipt;
if($sendResult == 'Warning') {
if ($injectionResponse->MessageResults && is_array($injectionResponse->MessageResults) && count($injectionResponse->MessageResults) > 0) {
$errorCode = $injectionResponse->MessageResults[0]['ErrorCode'];
$newResponse->result = $errorCode;
}
}
if ($injectionResponse->MessageResults && is_array($injectionResponse->MessageResults) && count($injectionResponse->MessageResults) > 0) {
$newResponse->addressResults = $injectionResponse->MessageResults[0]->AddressResults;
}
}
else{
$sendResult = InjectionResponseParser::DetermineSendResult(null, $responseHeader);
$newResponse = new \Socketlabs\SendResponse($sendResult);
}
return $newResponse;
}
/**
* Enumerated SendResult of the payload response from the Injection Api
* @param $injectionResponse
* @param $responseHeader
* @return string
*/
private static function DetermineSendResult($injectionResponse, $responseHeader){
$headers = InjectionResponseParser::parseHeaders($responseHeader);
$statusCode = $headers['reponse_code'];
switch ($statusCode) {
case 200: // 200 OK
// Attempt to convert error code to SendResult enum
$errorCode = \Socketlabs\SendResult::get_const($injectionResponse->ErrorCode);
if ($errorCode == false) {
return \Socketlabs\SendResult::UnknownError;
} else {
return $errorCode;
}
case 500: // 500 Internal Server Error
return \Socketlabs\SendResult::InternalError;
case 408: // 408 Request Timeout
return \Socketlabs\SendResult::Timeout;
case 401: // 401 Unauthorized
return \Socketlabs\SendResult::InvalidAuthentication;
default:
return \Socketlabs\SendResult::UnknownError;
}
}
/**
* Helper function to parse headers
* @param array $headers
* @return array
* https://secure.php.net/manual/en/reserved.variables.httpresponseheader.php
*/
private static function parseHeaders( $headers )
{
$head = array();
foreach( $headers as $k=>$v )
{
$t = explode( ':', $v, 2 );
if( isset( $t[1] ) )
$head[ trim($t[0]) ] = trim( $t[1] );
else
{
$head[] = $v;
if( preg_match( "#HTTP/[0-9\.]+\s+([0-9]+)#",$v, $out ) )
$head['reponse_code'] = intval($out[1]);
}
}
return $head;
}
}
@@ -0,0 +1,58 @@
<?php
namespace Socketlabs\Core;
class RetryHandler{
private $httpClient;
private $endpointUrl;
private $retrySettings;
const ERROR_CODES = array(500, 502, 503, 504);
public function __construct($client, $endpointurl, $settings){
$this->httpClient = $client;
$this->endpointUrl = $endpointurl;
$this->retrySettings = $settings;
}
public function send(){
if ($this->retrySettings->getMaximumNumberOfRetries() == 0){
$context = stream_context_create($this->httpClient);
$response = @file_get_contents($this->endpointUrl, FALSE, $context);
if (isset($http_response_header)) {
return array($response, $http_response_header);
}
else {
return array($response);
}
}
$attempts = 0;
do {
$waitInterval = (int)$this->retrySettings->getNextWaitInterval($attempts)/1000;
$context = stream_context_create($this->httpClient);
$response = @file_get_contents($this->endpointUrl, FALSE, $context);
if (($attempts < $this->retrySettings->getMaximumNumberOfRetries()) && (($response === FALSE && !isset($http_response_header)) || (in_array(intval(explode(" ", $http_response_header[0])[1]), self::ERROR_CODES)))){
$attempts++;
sleep($waitInterval);
}
else{
return array($response, $http_response_header);
}
} while(TRUE);
}
}
@@ -0,0 +1,413 @@
<?php
namespace Socketlabs\Core;
use Socketlabs\Message\BulkRecipient;
/**
* Used by the SocketLabsClient to conduct basic validation on the message before sending to the Injection API.
*/
class SendValidator
{
/**
* Maximum recipient threshold
*/
private static $MaximumRecipientsPerMessage = 50;
/**
* Validate the ServerId and Api Key pair prior before sending to the Injection API.
* @param string $serverId Your SocketLabs ServerId number.
* @param string $apiKey Your SocketLabs Injection API key.
* @return \Socketlabs\SendResponse with the validation results
*/
public static function validateCredentials($serverId, $apiKey)
{
$sendResponse = new \Socketlabs\SendResponse();
if (!is_string($apiKey) || ctype_space($apiKey) || $apiKey == "") {
$sendResponse->result = \Socketlabs\SendResult::AuthenticationValidationFailed;
} else if (!is_numeric($serverId) || (int)$serverId <= 0) {
$sendResponse->result = \Socketlabs\SendResult::AuthenticationValidationFailed;
} else {
$sendResponse->result = \Socketlabs\SendResult::Success;
}
return $sendResponse;
}
/**
* Validate a basic/bulk email message before sending to the Injection API.
* @param object $message
* @return \Socketlabs\SendResponse with the validation results
*/
public static function validateMessage($message)
{
if (is_a($message, "Socketlabs\Message\BasicMessage")) {
return SendValidator::validateBasicMessage($message);
} else if (is_a($message, "Socketlabs\Message\BulkMessage")) {
return SendValidator::validateBulkMessage($message);
}
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::InvalidData);
}
/**
* Validate a bulk email message.
* @param object $message
* @return \Socketlabs\SendResponse with the validation results
*/
private static function validateBulkMessage($message)
{
$validationResult = SendValidator::validateBaseMessage($message);
if ($validationResult->result == \Socketlabs\SendResult::Success) {
foreach ($message->to as &$to) if (is_string($to)) $to = new BulkRecipient($to);
$allRecipients = $message->to;
$count = count($allRecipients);
if ($count <= 0) $validationResult = new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationNoneInMessage);
else if ($count > SendValidator::$MaximumRecipientsPerMessage) $validationResult = new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationMaxExceeded);
else $validationResult = SendValidator::validateRecipients($allRecipients);
}
if ($validationResult->result == \Socketlabs\SendResult::Success) {
$validationResult = SendValidator::validateMergeData($message->to);
}
return $validationResult;
}
/**
* Validate a basic email message.
* @param object $message
* @return \Socketlabs\SendResponse with the validation results
*/
private static function validateBasicMessage($message)
{
$validationResult = SendValidator::validateBaseMessage($message);
if ($validationResult->result == \Socketlabs\SendResult::Success) {
foreach ($message->to as &$to) if (is_string($to)) $to = new EmailAddress($to);
foreach ($message->cc as &$cc) if (is_string($cc)) $cc = new EmailAddress($cc);
foreach ($message->bcc as &$bcc) if (is_string($bcc)) $bcc = new EmailAddress($bcc);
$allRecipients = array_merge($message->to, $message->cc, $message->bcc);
$count = count($allRecipients);
if ($count <= 0) $validationResult = new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationNoneInMessage);
else if ($count > SendValidator::$MaximumRecipientsPerMessage) $validationResult = new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationMaxExceeded);
else $validationResult = SendValidator::validateRecipients($allRecipients);
}
return $validationResult;
}
/**
* Validate the base email message.
* @param object $message
* @return \Socketlabs\SendResponse with the validation results
*/
private static function validateBaseMessage($message)
{
if (!SendValidator::HasSubject($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::MessageValidationEmptySubject);
} else if (!SendValidator::hasValidFrom($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::EmailAddressValidationInvalidFrom);
} else if (!SendValidator::hasValidReplyTo($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationInvalidReplyTo);
} else if (!SendValidator::hasMessageBody($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::MessageValidationEmptyMessage);
} else if (!SendValidator::hasValidCustomHeaders($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::MessageValidationInvalidCustomHeaders);
} else if (!SendValidator::hasValidMetadata($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::MessageValidationInvalidMetadata);
} else if (!SendValidator::hasValidTags($message)) {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::MessageValidationInvalidTag);
} else {
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::Success);
}
}
/**
* Check if the message has a subject
* @param object $message
* @return bool
*/
private static function hasSubject($message)
{
$subject = $message->subject;
if (is_string($subject) && !ctype_space($subject) && $subject != "") return true;
return false;
}
/**
* Check if the message has a valid From Email Address
* @param object $message
* @return bool
*/
private static function hasValidFrom($message)
{
$from = $message->from;
if ($from == null) return false;
if (is_a($from, "Socketlabs\Message\EmailAddress") && $from->isValid()) return true;
return false;
}
/**
* If set, check if a ReplyTo email address is valid
* @param object $message
* @return bool
*/
public static function hasValidReplyTo($message)
{
$replyTo = $message->replyTo;
if ($replyTo == null) return true; //The value is allowed to be null.
if (is_a($replyTo, "Socketlabs\Message\EmailAddress") && $replyTo->isValid()) return true;
return false;
}
/**
* Check if the message has a Message Body
* If an Api Template is specified it will override the HtmlBody and/or the PlainTextBody.
* If no Api Template is specified the HtmlBody AND the PlainTextBody must be valid
* </remarks>
* @param object $message
* @return bool
*/
public static function hasMessageBody($message)
{
$hasApiTemplate = SendValidator::HasApiTemplate($message);
if ($hasApiTemplate === true) {
//If there is a api template, null out the html and text portions of the message
$message->htmlBody = null;
$message->plainTextBody = null;
return true;
}
$htmlBody = $message->htmlBody;
if (!is_string($htmlBody) || ctype_space($htmlBody) || $htmlBody == "") return false;
$textBody = $message->plainTextBody;
if (!is_string($textBody) || ctype_space($textBody) || $textBody == "") return false;
return true;
}
/**
* Check if an ApiTemplate was specified and is valid
* @param object $message
* @return bool
*/
public static function hasApiTemplate($message)
{
$apiTemplate = $message->apiTemplate;
if (is_numeric($apiTemplate) && (int)$apiTemplate > 0) return true;
return false;
}
/**
* Check if ICustomHeader in List are valid
* @param object $customHeaders
* @return bool
*/
public static function hasValidCustomHeaders($message)
{
$customHeaders = $message->customHeaders;
if (!is_array($customHeaders)) return false;
$validCustomHeaders = true;
while ($validCustomHeaders && $customHeader = current($customHeaders)) {
if (is_a($customHeader, "Socketlabs\Message\CustomHeader")) {
$validCustomHeaders = $validCustomHeaders &&
SendValidator::not_empty($customHeader->name) &&
SendValidator::not_empty($customHeader->value);
} else {
$key = key($customHeaders);
$validCustomHeaders = $validCustomHeaders &&
SendValidator::not_empty($key) &&
SendValidator::not_empty($customHeader);
}
next($customHeaders);
}
return $validCustomHeaders;
}
/**
* Check if metadata is valid
* @param object $message
* @return boolean
*/
public static function hasValidMetadata($message)
{
$arr = $message->metadata;
if (!is_array($arr)) return false;
$validMetadata = true;
while ($validMetadata && $metadata = current($arr)) {
if (is_a($metadata, "Socketlabs\Message\Metadata")) {
$validMetadata = $validMetadata &&
SendValidator::not_empty($metadata->key) &&
SendValidator::not_empty($metadata->value);
} else {
$key = key($arr);
$validMetadata = $validMetadata &&
SendValidator::not_empty($key) &&
SendValidator::not_empty($metadata);
}
next($arr);
}
return $validMetadata;
}
/**
* Check if tags are valid
* @param object $message
* @return boolean
*/
public static function hasValidTags($message)
{
$arr = $message->tags;
if (!is_array($arr)) return false;
$validTags = true;
while ($validTags && $tag = current($arr)) {
$validTags = SendValidator::not_empty($tag);
next($arr);
}
return $validTags;
}
/**
* Validate email recipients for a basic message
* Checks the To, Cc, and the Bcc recipient fields (List of EmailAddress) for the following:
* a) At least 1 recipient is in the list.
* b) Cumulative count of recipients in all 3 lists do not exceed the MaximumRecipientsPerMessage.
* c) Recipients in lists are valid.
* If errors are found, the SendResponse will contain the invalid email addresses
* @param array $recipients
* @return \Socketlabs\SendResponse with the validation results
*/
private static function validateRecipients($recipients)
{
$invalidRecipients = SendValidator::hasInvalidRecipients($recipients);
if (count($invalidRecipients) > 0) {
$returnValue = new \Socketlabs\SendResponse(\Socketlabs\SendResult::RecipientValidationInvalidRecipients);
$returnValue->addressResults = $invalidRecipients;
return $returnValue;
}
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::Success);
}
/**
* Check all 3 recipient lists To, Cc, and Bcc (List of EmailAddress) for valid email addresses
* @param \Socketlabs\Message\EmailAddress[] $recipients
* @return array of AddressResult if an invalid email address is found.
*/
private static function hasInvalidRecipients($recipients)
{
$invalidEmails = array();
foreach ($recipients as $recipient) {
if (is_a($recipient, "Socketlabs\Message\EmailAddress") && $recipient->isValid()) {
continue;
}
$addressResult = new \Socketlabs\AddressResult();
$addressResult->accepted = false;
$addressResult->errorCode = "InvalidAddress";
$addressResult->emailAddress = $recipient->emailAddress;
$invalidEmails[] = $addressResult;
}
return $invalidEmails;
}
/**
* Validate an array of BulkRecipient and return an AddressResult for each invalid item.
* @param array $recipients
* @return array
*/
private static function getRecipientsWithInvalidMergeData($recipients)
{
$invalidRecipient = array();
foreach ($recipients as $recipient) {
$names = array();
foreach ($recipient->mergeData as $mergeData) {
if ($mergeData->Name && is_string($mergeData->Name) && is_string($mergeData->Value)) {
$names[] = $mergeData->Name;
} else {
$addressResult = new \Socketlabs\AddressResult();
$addressResult->accepted = false;
$addressResult->errorCode = "InvalidMergeData";
$addressResult->emailAddress = $recipient->emailAddress;
$invalidRecipient[] = $addressResult;
break;
}
}
if (count(SendValidator::array_iunique($names)) !== count($names)) {
$addressResult = new \Socketlabs\AddressResult();
$addressResult->accepted = false;
$addressResult->errorCode = "InvalidMergeData";
$addressResult->emailAddress = $recipient->emailAddress;
$invalidRecipient[] = $addressResult;
}
}
return $invalidRecipient;
}
/**
* Validate all of the merge data for a given recipient
* @param array $recipients
* @returns boolean
*/
private static function validateMergeData($recipients)
{
$recipientsWithInvalidMergeData = SendValidator::getRecipientsWithInvalidMergeData($recipients);
if (count($recipientsWithInvalidMergeData) > 0) {
$sendResponse = new \Socketlabs\SendResponse(\Socketlabs\SendResult::InvalidMergeData);
$sendResponse->addressResults = $recipientsWithInvalidMergeData;
return $sendResponse;
}
return new \Socketlabs\SendResponse(\Socketlabs\SendResult::Success);
}
/**
* Helper function to remove case insensitive duplicates from an array of strings
* @param array $array
* @return array
*/
private static function array_iunique($array)
{
return array_intersect_key(
$array,
array_unique(array_map("StrToLower", $array))
);
}
/**
* Helper function to determine if a string is empty.
* @param string $value
* @return boolean
*/
private static function not_empty($value)
{
return is_string($value) && !ctype_space($value) && $value != "";
}
}
@@ -0,0 +1,29 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents an individual email address for a message.
* To be serialized into JSON string before sending to the Injection Api.
*/
class AddressJson {
/**
* A valid email address
*/
public $EmailAddress;
/**
* The friendly or display name for the recipient.
*/
public $FriendlyName;
/**
* Creates a new instance of the Socketlabs\Core\Serialization\AddressJson class and sets the email address.
* @param string $emailAddress A valid email address
* @param string friendlyName The friendly or display name for the recipient.
*/
public function __construct($emailAddress, $friendlyName)
{
$this->EmailAddress = $emailAddress;
$this->FriendlyName = $friendlyName;
}
}
@@ -0,0 +1,33 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents a message attachment in the form of a byte array.
* To be serialized into JSON string before sending to the Injection Api.
*/
class AttachmentJson {
/**
* Name of attachment (displayed in email clients)
*/
public $Name;
/**
* The BASE64 encoded string containing the contents of an attachment.
*/
public $Content;
/**
* When set, used to embed an image within the body of an email message.
*/
public $ContentId;
/**
* The ContentType (MIME type) of the attachment.
*/
public $ContentType;
/**
* A list of custom headers added to the attachment.
*/
public $CustomHeaders;
}
@@ -0,0 +1,29 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents a custom header as a name and value pair.
* To be serialized into JSON string before sending to the Injection Api.
*/
class CustomHeadersJson {
/**
* Gets or sets the custom header name.
*/
public $Name;
/**
* Gets or sets the custom header value.
*/
public $Value;
/**
* Creates a new instance of the CustomHeaderJson class and sets the name and value pair.
* @param string $name The name of your custom header.
* @param string $value The value for your custom header.
*/
public function __construct($name, $value)
{
$this->Name = $name;
$this->Value = $value;
}
}
@@ -0,0 +1,27 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents MergeData for a single message.
* To be serialized into JSON string before sending to the Injection Api.
*/
class MergeDataJson {
/**
* Defines merge field data for all messages in the request.
*/
public $Global;
/**
* Defines merge field data for each message.
*/
public $PerMessage;
/**
* Creates a new instance of the Socketlabs\Core\Serialization\MergeDataJson class.
*/
public function __construct()
{
$this->Global = array();
$this->PerMessage = array(array());
}
}
@@ -0,0 +1,29 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents a merge field as a field and value pair.
* To be serialized into JSON string before sending to the Injection Api.
*/
class MergeFieldJson {
/**
* Gets or sets the merge field.
*/
public $Field;
/**
* Gets or sets the merge field value.
*/
public $Value;
/**
* Creates a new instance of the Socketlabs\Core\Serialization\MergeFieldJson class and sets the field and value pair.
* @param string $field The field of your merge field.
* @param string @value The value for your merge field.
*/
public function __construct($field, $value)
{
$this->Field = $field;
$this->Value = $value;
}
}
@@ -0,0 +1,105 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents a message for sending to the Injection Api.
* To be serialized into JSON string before sending to the Injection Api.
*/
class MessageJson
{
/**
* Gets or sets the list of To recipients.
*/
public $To = array();
/**
* Gets or sets the list of CC recipients.
*/
public $Cc = array();
/**
* Gets or sets the list of BCC recipients.
*/
public $Bcc = array();
/**
* Gets or sets the From address.
*/
public $From;
/**
* Gets or sets the instance of the message Subject.
*/
public $Subject;
/**
* Gets or sets the list of merge data.
*/
public $MergeData;
/**
* Gets or sets the plain text portion of the message body.
*/
public $TextBody;
/**
* Gets or sets the HTML portion of the message body.
*/
public $HtmlBody;
/**
* Gets or sets the Api Template for the message.
*/
public $ApiTemplate;
/**
* Gets or sets the custom MailingId for the message.
*/
public $MailingId;
/**
* Gets or sets the custom MessageId for the message.
*/
public $MessageId;
/**
* The optional character set for your message.
*/
public $CharSet;
/**
* Gets or sets the Reply To address.
*/
public $ReplyTo;
/**
* Gets or sets the list of attachments.
*/
public $Attachments = array();
/**
* A list of custom message headers added to the message.
*/
public $CustomHeaders = array();
/**
* A list of metadata added to the message.
*/
public $Metadata = array();
/**
* A list of tags added to the message.
*/
public $Tags = array();
/**
* Creates a new instance of the MessageJson class.
*/
public function __construct()
{
$this->MergeData = new MergeDataJson();
}
}
@@ -0,0 +1,32 @@
<?php
namespace Socketlabs\Core\Serialization;
/**
* Represents a metadata as a key and value pair.
* To be serialized into JSON string before sending to the Injection Api.
*/
class MetadataJson
{
/**
* Gets or sets the metadata key.
*/
public $Key;
/**
* Gets or sets the metadata value.
*/
public $Value;
/**
* Creates a new instance of the MetadataJson class and sets the name and value pair.
* @param string $Key The key of your metadata.
* @param string $value The value for your metadata.
*/
public function __construct($key, $value)
{
$this->Key = $key;
$this->Value = $value;
}
}
@@ -0,0 +1,215 @@
<?php
namespace Socketlabs\Message;
/**
* Represents a message attachment
*/
class Attachment
{
/**
* Name of attachment (displayed in email clients).
* @var string|null
*/
public $name = null;
/**
* The MIME type for your attachment.
* @var string|null
*/
public $mimeType = null;
/**
* When set, used to embed an image within the body of an email message.
* Example - <img> src="cid:contentId" </img>
* @var string|null
*/
public $contentId = null;
/**
* Raw image data
* @var string|null
*/
public $content = null;
/**
* An optional list of custom headers added to the attachment
*/
public $customHeaders = array();
/**
* Creates attachment using content from specified path.
*
* @param string $path he path to your attachment on your local system.
* @param string $name Name of attachment (displayed in email clients).
* @param string $type The MIME type for your attachment.
* @param string $contentId When set, used to embed an image within the body of an email message.
* @param string $headers A list of custom headers added to the attachment.
* @return Attachment
*/
public static function createFromPath($path, $name = '', $type = '', $contentId = null, $headers = null){
// If a MIME type is not specified, try to work it out from the file name
$type = $type == '' ? Attachment::filenameToType($path) : $type;
$filename = basename($path);
$name = $name == "" ? $filename : $name;
$fileResource = fopen($path, 'r');
try{
return Attachment::createFromStream($fileResource, $name, $type, $contentId, $headers);
}
finally{
fclose($fileResource);
}
}
/**
* Creates attachment using content from resource stream.
*
* @param resource $resource .
* @param string $name Name of attachment (displayed in email clients).
* @param string $type The MIME type for your attachment.
* @param string $contentId When set, used to embed an image within the body of an email message.
* @param string $headers A list of custom headers added to the attachment.
* @return Attachment
*/
public static function createFromStream($resource, $name = '', $type = '', $contentId = null, $headers = null){
$attachment = new Attachment();
$attachment->name = $name;
$attachment->mimeType = $type;
$attachment->contentId = $contentId;
$attachment->customHeaders = $headers;
$attachment->content = stream_get_contents($resource);
return $attachment;
}
/**
* Map a file name to a MIME type.
* Defaults to 'application/octet-stream', i.e.. arbitrary binary data.
* @since 1.0.0
* @param string $filename A file name or full path, does not need to exist as a file
* @return string
* @static
*/
public static function filenameToType($filename)
{
// In case the path is a URL, strip any query string before getting extension
$qpos = strpos($filename, '?');
if (false !== $qpos) {
$filename = substr($filename, 0, $qpos);
}
$pathinfo = self::mb_pathinfo($filename);
return self::_mime_types($pathinfo['extension']);
}
/**
* Multi-byte-safe pathinfo replacement.
* Drop-in replacement for pathinfo(), but multibyte-safe, cross-platform-safe, old-version-safe.
* Works similarly to the one in PHP >= 5.2.0
* @link http://www.php.net/manual/en/function.pathinfo.php#107461
* @param string $path A filename or path, does not need to exist as a file
* @param integer|string $options Either a PATHINFO_* constant,
* or a string name to return only the specified piece, allows 'filename' to work on PHP < 5.2
* @return string|array
*/
public static function mb_pathinfo($path, $options = null)
{
$ret = array('dirname' => '', 'basename' => '', 'extension' => '', 'filename' => '');
$pathinfo = array();
if (preg_match('%^(.*?)[\\\\/]*(([^/\\\\]*?)(\.([^\.\\\\/]+?)|))[\\\\/\.]*$%im', $path, $pathinfo)) {
if (array_key_exists(1, $pathinfo)) {
$ret['dirname'] = $pathinfo[1];
}
if (array_key_exists(2, $pathinfo)) {
$ret['basename'] = $pathinfo[2];
}
if (array_key_exists(5, $pathinfo)) {
$ret['extension'] = $pathinfo[5];
}
if (array_key_exists(3, $pathinfo)) {
$ret['filename'] = $pathinfo[3];
}
}
switch ($options) {
case PATHINFO_DIRNAME:
case 'dirname':
return $ret['dirname'];
case PATHINFO_BASENAME:
case 'basename':
return $ret['basename'];
case PATHINFO_EXTENSION:
case 'extension':
return $ret['extension'];
case PATHINFO_FILENAME:
case 'filename':
return $ret['filename'];
default:
return $ret;
}
}
/**
* Gets the mime type from a file extension
* @param string $ext File extension (w/out dot)
* @return string MIME type of file.
*/
public static function _mime_types($ext = '')
{
$mimes = array(
'xml' => "application/xml",
'txt' => "text/plain",
'ini' => "text/plain",
'sln' => "text/plain",
'cs' => "text/plain",
'js' => "text/plain",
'config' => "text/plain",
'vb' => "text/plain",
'html' => "text/html",
'wav' => "audio/wav",
'eml' => "message/rfc822",
'mp3' => "audio/mpeg",
'mp4' => "video/mp4",
'bmp' => "image/bmp",
'gif' => "image/gif",
'jpeg' => "image/jpeg",
'jpg' => "image/jpeg",
'png' => "image/png",
'zip' => "pplication/x-zip-compressed",
'doc' => 'application/msword',
'docx' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
'xls' => 'application/vnd.ms-excel',
'xlsx' => 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'ppt' => 'application/vnd.ms-powerpoint',
'pptx' => 'application/vnd.openxmlformats-officedocument.presentationml.presentation',
'csv' => 'text/csv',
'pdf' => 'application/pdf',
'mov' => 'video/quicktime'
);
if (array_key_exists(strtolower($ext), $mimes)) {
return $mimes[strtolower($ext)];
}
return 'application/octet-stream';
}
}
@@ -0,0 +1,150 @@
<?php
namespace Socketlabs\Message;
/**
* Contains properties and methods common to all message types.
*/
class BaseMessage
{
/**
* Message subject.
* @var string|null
*/
public $subject;
/**
* Plain text portion of the message body.
*
* (Optional)
* Atleast one of the following body types must be set: $plainTextBody (with ampBody),
* $htmlBody (with ampBody), or $apiTemplate.
* @var string|null
*/
public $plainTextBody;
/**
* HTML portion of the message body.
*
* (Optional)
* Atleast one of the following body types must be set: $plainTextBody (with ampBody),
* $htmlBody (with ampBody), or $apiTemplate.
* @var string|null
*/
public $htmlBody;
/**
* Api Template Id used to specify a template to be used for the message Id.
*
* (Optional)
* Atleast one of the following body types must be set: $plainTextBody (with ampBody),
* $htmlBody (with ampBody), or $apiTemplate.
* @var string|null
*/
public $apiTemplate;
/**
* AmpBody Id used to specify a template to be used for the message Id.
*
* (Optional)
* Atleast one of the following body types must be set: $plainTextBody (with ampBody),
* $htmlBody (with ampBody), or $apiTemplate.
* @var string|null
*/
public $ampBody;
/**
* Custom MailingId for the message.
*
* (Optional)
* See https://www.socketlabs.com/blog/best-practices-for-using-custom-mailingids-and-messageids/ for more information.
* @var string|null
*/
public $mailingId;
/**
* Custom MessageId for the message.
*
* (Optional)
* See https://www.socketlabs.com/blog/best-practices-for-using-custom-mailingids-and-messageids/ for more information.
* @var string|null
*/
public $messageId;
/**
* From address.
*
* (Required)
* @var EmailAddress|null
*/
public $from;
/**
* An optional ReplyTo address for the message.
* @var EmailAddress|null
*/
public $replyTo;
/**
* The optional character set for your message.
*
* (Optional) Default is 'utf-8'
* @var string|null
*/
public $charset;
/**
* Optional array of message attachments.
* @var Attachment[]
*/
public $attachments = array();
/**
* Optional array of custom headers.
*/
public $customHeaders = array();
/**
* Optional array of custom headers.
*/
public $metadata = array();
/**
* Optional array of custom headers.
*/
public $tags = array();
/**
* Adds custom header to the message.
*
* @param string $name Header name.
* @param string $value Header value.
* @return static Message Instance.
*/
public function addCustomHeader($name, $value)
{
if (!is_string($name)) throw new \InvalidArgumentException("The custom header name property must be type string.");
if (!is_string($value)) throw new \InvalidArgumentException("The custom value property must be type string.");
$customHeader = new CustomHeader($name, $value);
$this->customHeaders[] = $customHeader;
return $this;
}
/**
* Adds metadata to the message.
*
* @param string $name metadata name.
* @param string $value metadata value.
* @return BaseMessage Message Instance.
*/
public function addMetadata($name, $value)
{
if (!is_string($name)) throw new \InvalidArgumentException("The metadata name property must be type string.");
if (!is_string($value)) throw new \InvalidArgumentException("The metadata value property must be type string.");
$metadata = new Metadata($name, $value);
$this->metadata[] = $metadata;
return $this;
}
}
@@ -0,0 +1,78 @@
<?php
namespace Socketlabs\Message;
/**
* A basic email message similar to one created in a personal email client such as Outlook.
* This message can have many recipients of different types, such as To, CC, and BCC. This
* message does not support merge fields.
*/
class BasicMessage extends BaseMessage
{
/**
* Array of To recipients. When adding directly to array, EmailAddress type should be used.
* @var EmailAddress[]
*/
public $to = array();
/**
* Array of CC recipients. When adding directly to array, EmailAddress type should be used.
* @var EmailAddress[]
*/
public $cc = array();
/**
* Array of BCC recipients. When adding directly to array, EmailAddress type should be used.
* @var EmailAddress[]
*/
public $bcc = array();
/**
* Adds recipient to To address array.
* @param string|EmailAddress $emailAddress Recipient's email address.
* @param string $friendlyName Recipient's friendly name.
*/
public function addToAddress($emailAddress, $friendlyName = null)
{
if (is_string($emailAddress)) {
$this->to[] = new \Socketlabs\Message\EmailAddress($emailAddress, $friendlyName = null);
} else if (is_a($emailAddress, "\Socketlabs\Message\EmailAddress")) {
$this->to[] = $emailAddress;
} else {
throw new \InvalidArgumentException("Socketlabs\\Message\\BaseMessage::addToAddress() parameter must be type string or type EmailAddress.");
}
}
/**
* Adds recipient to CC address array.
* @param string|EmailAddress $emailAddress Recipient's email address.
* @param string $friendlyName Recipient's friendly name.
*/
public function addCcAddress($emailAddress, $friendlyName = null)
{
if (is_string($emailAddress)) {
$this->cc[] = new EmailAddress($emailAddress, $friendlyName);
} else if (is_a($emailAddress, "\Socketlabs\Message\EmailAddress")) {
$this->cc[] = $emailAddress;
} else {
throw new \InvalidArgumentException("Socketlabs\\Message\\BaseMessage::addCcAddress() parameter must be type string or type EmailAddress.");
}
}
/**
* Adds recipient to BCC address array.
* @param string|EmailAddress $emailAddress Recipient's email address.
* @param string $friendlyName Recipient's friendly name.
*/
public function addBccAddress($emailAddress, $friendlyName = null)
{
if (is_string($emailAddress)) {
$this->bcc[] = new EmailAddress($emailAddress, $friendlyName);
} else if (is_a($emailAddress, "Socketlabs\Message\EmailAddress")) {
$this->bcc[] = $emailAddress;
} else {
throw new \InvalidArgumentException("Socketlabs\\Message\\BaseMessage::addBccAddress() parameter must be type string or type EmailAddress.");
}
}
}
@@ -0,0 +1,61 @@
<?php
namespace Socketlabs\Message;
/**
* A bulk message usually contains a single recipient per message
* and is generally used to send the same content to many recipients,
* optionally customizing the message via the use of MergeData.
*/
class BulkMessage extends BaseMessage{
/**
* An array of the message recipients
*/
public $to = array();
/**
* A array containing MergeData items that will be global across the whole message.
*/
public $global = array();
/**
* Add recipients to this message
* @param string $emailAddress
* @param string $friendlyName
*/
public function addToAddress($emailAddress, $friendlyName = null){
if(is_string($emailAddress)){
return $this->addToAddress(new BulkRecipient($emailAddress, $friendlyName));
}
else if(is_a($emailAddress, "Socketlabs\Message\BulkRecipient")){
$this->to[] = $emailAddress;
return $emailAddress;
}
else{
throw new \BadFunctionCallException("BulkMessage::addToAddress() parameter must be type string or type BulkRecipient.");
}
}
/**
* Add global merge data to the message
* @param string $name
* @param string $value
*/
public function addGlobalMergeData($name, $value){
if(!is_string($name)) throw new \InvalidArgumentException("The global merge data name property must be type string.");
if(!is_string($value)) throw new \InvalidArgumentException("The global merge data value property must be type string.");
$newMergeData = (object)array(
"Name" => $name,
"Value" => $value
);
foreach($this->global as &$mergeData){
// case-insensitive matching
if(strcasecmp($mergeData->Name, $newMergeData->Name) == 0) {
$mergeData = $newMergeData;
return $this;
}
}
$this->global[] = $newMergeData;
return $this;
}
}
@@ -0,0 +1,36 @@
<?php
namespace Socketlabs\Message;
/**
* Represents an individual recipient for a message.
*/
class BulkRecipient extends EmailAddress{
/**
* A dictionary containing MergeData items unique to the recipient.
*/
public $mergeData = array();
/**
* Add a new merge data oject to the array if the given values are valid.
* @param string $name
* @param string $value
*/
public function addMergeData($name, $value){
if(!is_string($name)) throw new InvalidArgumentException("The merge field name property must be type string.");
if(!is_string($value)) throw new InvalidArgumentException("The merge field value property must be type string.");
$newMergeData = (object)array(
"Name" => $name,
"Value" => $value
);
foreach($this->mergeData as &$mergeData){
// case-insensitive matching
if(strcasecmp($mergeData->Name, $newMergeData->Name) == 0) {
$mergeData = $newMergeData;
return;
}
}
$this->mergeData[] = $newMergeData;
return $this;
}
}
@@ -0,0 +1,27 @@
<?php
namespace Socketlabs\Message;
/**
* Used to create, manage and manipulate custom headers for messages
*/
class CustomHeader{
/**
* The name of the custom header
*/
public $name;
/**
* The value of the custom header
*/
public $value;
/**
* Create a new instance of CustomHeader
* @param string $name
* @param string $value
*/
public function __construct($name, $value){
$this->name = $name;
$this->value = $value;
}
}
@@ -0,0 +1,48 @@
<?php
namespace Socketlabs\Message;
/**
* Represents an individual email address for a message.
*/
class EmailAddress{
/**
* A valid email address
* @var string
*/
public $emailAddress;
/**
* The friendly or display name for the recipient.
* @var string|null
*/
public $friendlyName;
/**
* Creates a new instance of the EmailAddress class.
* @param string $emailAddress
* @param string|null $friendlyName
*/
public function __construct($emailAddress, $friendlyName = null){
$this->emailAddress = $emailAddress;
if($friendlyName) $this->friendlyName = $friendlyName;
}
/**
* Determines if the Email Address is valid.
* @return bool
*/
public function isValid(){
$email = $this->emailAddress;
if(is_string($email) && !ctype_space($email) && $email != "")
{
$parts = explode("@", $email);
if( count($parts) == 2 &&
strlen($email) < 320 &&
strlen($parts[0]) > 1 &&
strlen($parts[1]) > 1){
return true;
}
}
return false;
}
}
@@ -0,0 +1,31 @@
<?php
namespace Socketlabs\Message;
/**
* Used to create, manage and manipulate Metadata for messages
*/
class Metadata
{
/**
* The key of the Metadata
*/
public $key;
/**
* The value of the Metadata
*/
public $value;
/**
* Create a new instance of Metadata
* @param string $key
* @param string $value
*/
public function __construct($key, $value)
{
$this->key = $key;
$this->value = $value;
}
}
@@ -0,0 +1,45 @@
<?php
namespace Socketlabs;
class RetrySettings{
const DEFAULT_NUMBER_OF_RETRIES = 0;
const MAXIMUM_ALLOWED_NUMBER_OF_RETRIES = 5;
const MINIMUM_RETRY_TIME = 1;
const MAXIMUM_RETRY_TIME = 10;
private $maximumNumberOfRetries;
public function __construct($maximumNumberOfRetries=null){
if (!is_null($maximumNumberOfRetries)){
if ($maximumNumberOfRetries < 0) {throw new InvalidArgumentException("maximumNumberOfRetries must be greater than 0");}
if ($maximumNumberOfRetries > self::MAXIMUM_ALLOWED_NUMBER_OF_RETRIES) {throw new InvalidArgumentException("The maximum number of allowed retries is ".self::MAXIMUM_ALLOWED_NUMBER_OF_RETRIES);}
$this->maximumNumberOfRetries = $maximumNumberOfRetries;
}
else{
$this->maximumNumberOfRetries = self::DEFAULT_NUMBER_OF_RETRIES;
}
}
public function getMaximumNumberOfRetries(){
return $this->maximumNumberOfRetries;
}
public function getNextWaitInterval($numberOfAttempts){
$interval = (int)min(
((self::MINIMUM_RETRY_TIME * 1000) + RetrySettings::getRetryDelta($numberOfAttempts)),
(self::MAXIMUM_RETRY_TIME * 1000)
);
return $interval;
}
private static function getRetryDelta($numberOfAttempts){
$min = (int)(1 * 1000 * 0.8);
$max = (int)(1 * 1000 * 1.2);
return (int)((pow(2.0, $numberOfAttempts) - 1.0) * rand($min, $max));
}
}
@@ -0,0 +1,164 @@
<?php
namespace Socketlabs;
/**
* The response of an SocketLabsClient send request.
* @property-read string responseMessage
*/
class SendResponse{
/**
* The result of the SocketLabsClient send request.
* @var string|null
*/
public $result;
/**
* A unique key generated by the Injection API if an unexpected error occurs during the SocketLabsClient send request.
* This unique key can be used by SocketLabs support to troubleshoot the issue.
* @var string|null
*/
public $transactionReceipt;
/**
* An array of AddressResult objects that contain the status of each address that failed. If no messages failed this array is empty.
* @var object[]
*/
public $addressResults = array();
/**
* Create a new instance of SendResponse
* @param string|null $result
*/
public function __construct($result = null){
$this->result = $result;
}
/**
* Handle getter for specific property names.
*/
function __get($name) {
if($name === 'responseMessage'){
switch ($this->result)
{
case \Socketlabs\SendResult::UnknownError:
return "An error has occured that was unforeseen";
case \Socketlabs\SendResult::Timeout:
return "A timeout occurred sending the message";
case \Socketlabs\SendResult::Success:
return "Successful send of message";
case \Socketlabs\SendResult::Warning:
return "Warnings were found while sending the message";
case \Socketlabs\SendResult::InternalError:
return "Internal server error";
case \Socketlabs\SendResult::MessageTooLarge:
return "Message size has exceeded the size limit";
case \Socketlabs\SendResult::TooManyRecipients:
return "Message exceeded maximum recipient count in the message";
case \Socketlabs\SendResult::InvalidData:
return "Invalid data was found on the message";
case \Socketlabs\SendResult::OverQuota:
return "The account is over the send quota, rate limit exceeded";
case \Socketlabs\SendResult::TooManyErrors:
return "Too many errors occurred sending the message";
case \Socketlabs\SendResult::InvalidAuthentication:
return "The ServerId/ApiKey combination is invalid";
case \Socketlabs\SendResult::AccountDisabled:
return "The account has been disabled";
case \Socketlabs\SendResult::TooManyMessages:
return "Too many messages were found in the request";
case \Socketlabs\SendResult::NoValidRecipients:
return "No valid recipients were found in the message";
case \Socketlabs\SendResult::InvalidAddress:
return "An invalid recipient were found on the message";
case \Socketlabs\SendResult::InvalidAttachment:
return "An invalid attachment were found on the message";
case \Socketlabs\SendResult::NoMessages:
return "No message body was found in the message";
case \Socketlabs\SendResult::EmptyMessage:
return "No message body was found in the message";
case \Socketlabs\SendResult::EmptySubject:
return "No subject was found in the message";
case \Socketlabs\SendResult::InvalidFrom:
return "An invalid from address was found on the message";
case \Socketlabs\SendResult::EmptyToAddress:
return "No To addresses were found in the message";
case \Socketlabs\SendResult::NoValidBodyParts:
return "No valid message body was found in the message";
case \Socketlabs\SendResult::InvalidTemplateId:
return "An invalid TemplateId was found in the message";
case \Socketlabs\SendResult::TemplateHasNoContent:
return "The specified TemplateId has no content for the message";
case \Socketlabs\SendResult::MessageBodyConflict:
return "A conflict occurred on the message body of the message";
case \Socketlabs\SendResult::InvalidMergeData:
return "Invalid MergeData was found on the message";
case \Socketlabs\SendResult::MetadataOrTagsAreTooLarge:
return "Metadata and tags exceed 12.5KB";
case \Socketlabs\SendResult::AuthenticationValidationFailed:
return "SDK Validation Error : Authentication Validation Failed, Missing or invalid ServerId or ApiKey";
case \Socketlabs\SendResult::RecipientValidationMaxExceeded:
return "SDK Validation Error : Message exceeded maximum recipient count in the message";
case \Socketlabs\SendResult::RecipientValidationNoneInMessage:
return "SDK Validation Error : No Recipients were found in the message";
case \Socketlabs\SendResult::EmailAddressValidationMissingFrom:
return "SDK Validation Error : From email address is missing in the message";
case \Socketlabs\SendResult::RecipientValidationMissingTo:
return "SDK Validation Error : To addresses are missing in the message";
case \Socketlabs\SendResult::EmailAddressValidationInvalidFrom:
return "SDK Validation Error : From email address in the message is invalid";
case \Socketlabs\SendResult::MessageValidationEmptySubject:
return "SDK Validation Error : No Subject was found in the message";
case \Socketlabs\SendResult::MessageValidationEmptyMessage:
return "SDK Validation Error : No message body was found in the message";
case \Socketlabs\SendResult::MessageValidationInvalidCustomHeaders:
return "SDK Validation Error : Invalid Custom Headers were found in the message";
case \Socketlabs\SendResult::RecipientValidationInvalidReplyTo:
return "SDK Validation Error : Invalid ReplyTo Address was found in the message";
case \Socketlabs\SendResult::RecipientValidationInvalidRecipients:
return "SDK Validation Error : Invalid recipients were found in the message";
default:
return "";
}
}
user_error("Invalid property: " . __CLASS__ . "->$name");
}
}
@@ -0,0 +1,226 @@
<?php
/**
* Enumerated result of the client send
*/
namespace Socketlabs;
abstract class SendResult
{
/**
* An error has occured that was unforeseen
*/
const UnknownError = "UnknownError";
/**
* A timeout occurred sending the message
*/
const Timeout = "Timeout";
/**
* Successful send of message
*/
const Success = "Success";
/**
* Warnings were found while sending the message
*/
const Warning = "Warning";
/**
* Internal server error
*/
const InternalError = "InternalError";
/**
* Message size has exceeded the size limit
*/
const MessageTooLarge = "MessageTooLarge";
/**
* Message exceeded maximum recipient count in the message
*/
const TooManyRecipients = "TooManyRecipients";
/**
* Invalid data was found on the message
*/
const InvalidData = "InvalidData";
/**
* The account is over the send quota, rate limit exceeded
*/
const OverQuota = "OverQuota";
/**
* Too many errors occurred sending the message
*/
const TooManyErrors = "TooManyErrors";
/**
* The ServerId/ApiKey combination is invalid
*/
const InvalidAuthentication = "InvalidAuthentication";
/**
* The account has been disabled
*/
const AccountDisabled = "AccountDisabled";
/**
* Too many messages were found in the request
*/
const TooManyMessages = "TooManyMessages";
/**
* No valid recipients were found in the message
*/
const NoValidRecipients = "NoValidRecipients";
/**
* An invalid recipient were found on the message
*/
const InvalidAddress = "InvalidAddress";
/**
* An invalid attachment were found on the message
*/
const InvalidAttachment = "InvalidAttachment";
/**
* No message body was found in the message
*/
const NoMessages = "NoMessages";
/**
* No message body was found in the message
*/
const EmptyMessage = "EmptyMessage";
/**
* No subject was found in the message
*/
const EmptySubject = "EmptySubject";
/**
* An invalid from address was found on the message
*/
const InvalidFrom = "InvalidFrom";
/**
* No To addresses were found in the message
*/
const EmptyToAddress = "EmptyToAddress";
/**
* No valid message body was found in the message
*/
const NoValidBodyParts = "NoValidBodyParts";
/**
* An invalid TemplateId was found in the message
*/
const InvalidTemplateId = "InvalidTemplateId";
/**
* The specified TemplateId has no content for the message
*/
const TemplateHasNoContent = "TemplateHasNoContent";
/**
* A conflict occurred on the message body of the message
*/
const MessageBodyConflict = "MessageBodyConflict";
/**
* Invalid MergeData was found on the message
*/
const InvalidMergeData = "InvalidMergeData";
/**
* Metadata and tags exceed 12.5KB
*/
const MetadataOrTagsAreTooLarge = "MetadataOrTagsAreTooLarge";
/**
* Authentication Error, Missing or invalid ServerId or ApiKey
*/
const AuthenticationValidationFailed = "AuthenticationValidationFailed";
/**
* From email address is missing in the message
*/
const EmailAddressValidationMissingFrom = "EmailAddressValidationMissingFrom";
/**
* From email address in the message in invalid
*/
const EmailAddressValidationInvalidFrom = "EmailAddressValidationInvalidFrom";
/**
* Message exceeded maximum recipient count in the message
*/
const RecipientValidationMaxExceeded = "RecipientValidationMaxExceeded";
/**
* No recipients were found in the message
*/
const RecipientValidationNoneInMessage = "RecipientValidationNoneInMessage";
/**
* To addresses are missing in the message
*/
const RecipientValidationMissingTo = "RecipientValidationMissingTo";
/**
* Invalid ReplyTo address found
*/
const RecipientValidationInvalidReplyTo = "RecipientValidationInvalidReplyTo";
/**
* Invalid recipients found
*/
const RecipientValidationInvalidRecipients = "RecipientValidationInvalidRecipients";
/**
* No subject was found in the message
*/
const MessageValidationEmptySubject = "MessageValidationEmptySubject";
/**
* No message body was found in the message
*/
const MessageValidationEmptyMessage = "MessageValidationEmptyMessage";
/**
* Invalid custom headers found
*/
const MessageValidationInvalidCustomHeaders = "MessageValidationInvalidCustomHeaders";
/**
* Invalid metadata found
*/
const MessageValidationInvalidMetadata = "MessageValidationInvalidMetadata";
/**
* Invalid metadata found
*/
const MessageValidationInvalidTag = "MessageValidationInvalidTag";
/**
* Get a value for a given name
* @param $name
* @return string|false
*/
public static function get_const($name)
{
$constant = 'self::' . $name;
if (defined($constant)) {
return constant($constant);
} else {
return false;
}
}
}
@@ -0,0 +1,151 @@
<?php
namespace Socketlabs;
/**
* SocketLabsClient is a wrapper for the SocketLabs Injection API that makes
* it easy to send messages and parse responses.
* Example:
* $client = new SocketLabsClient(00000, "apiKey");
* $message = new BasicMessage();
* //Build Message Here
* $response = client.Send(message);
* if (response.Result != SendResult.Success)
* {
* // Handle Error
* }
*/
class SocketLabsClient{
private $serverId;
private $apiKey;
const VERSION = "1.4.5";
public $version = self::VERSION;
/**
* Configure to different endpoint if the need arises
*/
public $endpointUrl;
/**
* Configure proxy such as fiddler if desired
*/
public $proxyUrl;
/**
* Configure to different timeout if desired
*/
public $requestTimeout;
/**
* Configure to different timeout if desired
*/
public $numberOfRetries;
/**
* Creates a new instance of the SocketLabsClient.
*/
public function __construct($serverId, $apiKey){
$this->serverId = $serverId;
$this->apiKey = $apiKey;
$this->endpointUrl = "https://inject.socketlabs.com/api/v1/email";
$this->requestTimeout = 120;
$this->numberOfRetries = 0;
$this::setUserAgent();
}
/**
* Sends a basic/bulk email message and returns the response from the Injection API.
* @return SendResponse
*/
public function send($message){
$validationResult = Core\SendValidator::validateCredentials($this->serverId, $this->apiKey);
if($validationResult->result != \Socketlabs\SendResult::Success) return $validationResult;
$validationResult = Core\SendValidator::validateMessage($message);
if($validationResult->result != \Socketlabs\SendResult::Success) return $validationResult;
$factory = new Core\InjectionRequestFactory($this->serverId, $this->apiKey);
$newRequest = $factory->generateRequest($message);
$apiKeyParser = new Core\ApiKeyParser();
$parseResult = $apiKeyParser->parse($this->apiKey);
$options;
if ($parseResult === Core\ApiKeyParseResult::Success)
{
$options = $this->createStreamOptions($newRequest, $this->apiKey);
}
else {
$options = $this->createStreamOptions($newRequest, '');
}
$retrySettings = new RetrySettings($this->numberOfRetries);
$retryHandler = new Core\RetryHandler($options, $this->endpointUrl, $retrySettings);
list($response, $responseHeader) = $retryHandler->send();
return Core\InjectionResponseParser::parse($response, $responseHeader);
}
/**
* Helper function to set the user agent
*/
private function setUserAgent(){
$phpVersion = phpversion();
$userAgent = "SocketLabs-php/$this->version(php $phpVersion)";
ini_set("user_agent", $userAgent);
}
/**
* Helper function to create the stream options
* @param $injectionRequest
*/
private function createStreamOptions($injectionRequest, $bearerToken){
$header = array('Content-type: application/json');
if (strlen($bearerToken) > 0) {
$header = array('Content-type: application/json', 'Authorization: Bearer '.$bearerToken);
$injectionRequest->ApiKey = '';
}
$http = array(
'method' => 'POST',
'header' => $header,
'content' => json_encode($injectionRequest),
'timeout' => $this->requestTimeout
);
//proxy not enabled, return these simple options
if($this->proxyUrl == null){
return array('http' => $http);
}
//shape proxy url to use 'tcp'
$tcpUrl = str_replace('https', 'tcp', $this->proxyUrl);
$tcpUrl = str_replace('http', 'tcp', $tcpUrl);
//set proxy
$http += ['proxy' => $tcpUrl];
//include ssl options
return array(
"http" => $http
// If you are having trouble configuring a proxy tool such as fiddler, this can be a quick fix,
// but it is not recommended for production. The best way is to configure the appropriate certificate
// authority property in your php.ini, for example: 'openssl.cafile'
//Proxy Quick Fix:
//,
//"ssl"=> array(
// "verify_peer"=>false,
// "verify_peer_name"=>false,
//)
);
}
}
@@ -0,0 +1,34 @@
<?php
if (!defined('SOCKETLABS_INJECTION_API_ROOT_PATH')) define('SOCKETLABS_INJECTION_API_ROOT_PATH', dirname(__DIR__));
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/ApiKeyParser.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/ApiKeyParseResult.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/InjectionRequest.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/RetryHandler.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/InjectionRequestFactory.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/ApiKeyParser.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/InjectionResponseParser.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/SendValidator.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/AddressJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/AttachmentJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/CustomHeadersJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/MergeDataJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/MergeFieldJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/MessageJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Core/Serialization/MetadataJson.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/Attachment.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/CustomHeader.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/BaseMessage.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/BasicMessage.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/BulkMessage.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/EmailAddress.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/BulkRecipient.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/Message/Metadata.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/AddressResult.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/RetrySettings.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/SendResponse.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/SendResult.php");
include_once(SOCKETLABS_INJECTION_API_ROOT_PATH . "/src/SocketLabsClient.php");
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 SocketLabs
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
@@ -0,0 +1,215 @@
[![SocketLabs](https://static.socketlabs.com/logos/logo-dark-326x64.png)](https://www.socketlabs.com/developers)
# [![Twitter Follow](https://img.shields.io/twitter/follow/socketlabs.svg?style=social&label=Follow)](https://twitter.com/socketlabs) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](./LICENSE) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://github.com/socketlabs/socketlabs-nodejs/blob/master/CONTRIBUTING.md)
The SocketLabs Email Delivery PHP library allows you to easily send email messages via the [SocketLabs Injection API](https://www.socketlabs.com/docs/inject/). The library makes it easy to build and send any type of message supported by the API, from a simple message to a single recipient all the way to a complex bulk message sent to a group of recipients with unique merge data per recipient.
# Table of Contents
* [Prerequisites and Installation](#prerequisites-and-installation)
* [Getting Started](#getting-started)
* [Managing API Keys](#managing-api-keys)
* [Examples and Use Cases](#examples-and-use-cases)
* [License](#license)
<a name="prerequisites-and-installation"></a>
# Prerequisites and Installation
## Prerequisites
* PHP 5.6 or higher
* A SocketLabs account. If you don't have one yet, you can [sign up for a free account](https://signup.socketlabs.com/step-1?plan=free) to get started.
## Installation
For most uses we recommend installing the [socketlabs/email-delivery](https://packagist.org/packages/socketlabs/email-delivery) package via Composer. If you have [Composer](https://getcomposer.org) installed already, you can add the latest version of the package with the following command:
```
composer require socketlabs/email-delivery
```
Alternately, you can simply [clone this repository](https://github.com/socketlabs/socketlabs-php.git) directly to include the source code in your project. Be sure to reference the following includes for your convenience: [includes.php](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/src/includes.php).
<a name="getting-started"></a>
# Getting Started
## Obtaining your API Key and SocketLabs ServerId number
In order to get started, you'll need to enable the Injection API feature in the [SocketLabs Control Panel](https://cp.socketlabs.com).
Once logged in, navigate to your SocketLabs server's dashboard (if you only have one server on your account you'll be taken here immediately after logging in).
Make note of your 4 or 5 digit ServerId number, as you'll need this along with
your API key in order to use the Injection API.
To enable the Injection API, click on the "For Developers" dropdown on the top-level navigation, then choose the "Configure HTTP Injection API" option.
Once here, you can enable the feature by choosing the "Enabled" option in the
dropdown. Enabling the feature will also generate your API key, which you'll
need (along with your ServerId) to start using the API. Be sure to click the
"Update" button to save your changes once you are finished.
## Basic Message
A basic message is an email message like you'd send from a personal email client such as Outlook.
A basic message can have many recipients, including multiple To addresses, CC addresses, and even BCC addresses.
You can also send a file attachment in a basic message.
```PHP
include_once ("./socketlabs-php/InjectionApi/src/includes.php");
//or if using composer: include_once ('./vendor/autoload.php');
use Socketlabs\SocketLabsClient;
use Socketlabs\Message\BasicMessage;
use Socketlabs\Message\EmailAddress;
$client = new SocketLabsClient(000001, "YOUR-API-KEY"); //Your SocketLabs ServerId and Injection API key
$message = new BasicMessage();
$message->subject = "Sending A Basic Message";
$message->htmlBody = "<html>This is the Html Body of my message.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message.";
$message->from = new EmailAddress("[email protected]");
$message->replyTo = new EmailAddress("[email protected]");
//A basic message supports up to 50 recipients and supports several different ways to add recipients
$message->addToAddress("[email protected]"); //Add a To address by passing the email address
$message->addCcAddress("[email protected]", "Recipient #2"); //Add a CC address by passing the email address and a friendly name
$message->addBccAddress(new EmailAddress("[email protected]")); //Add a BCC address by passing an EmailAddress object
$response = $client->send($message);
```
## Bulk Message
A bulk message usually contains a single recipient per message
and is generally used to send the same content to many recipients,
optionally customizing the message via the use of MergeData.
For more information about using Merge data, please see the [Injection API documentation](https://www.socketlabs.com/api-reference/injection-api/#merging).
```PHP
include_once ("./socketlabs-php/InjectionApi/src/includes.php");
//or if using composer: include_once ('./vendor/autoload.php');
use Socketlabs\Message\BulkMessage;
use Socketlabs\Message\BulkRecipient;
use Socketlabs\Message\EmailAddress;
use Socketlabs\SocketLabsClient;
$client = new SocketLabsClient(000001, "YOUR-API-KEY"); //Your SocketLabs ServerId and Injection API key
//Build the message
$message = new BulkMessage();
$message->subject = "Sending A Bulk Message";
$message->htmlBody = "<html>This is the Html Body of my message sent to the recipient with %%EyeColor%% eyes.</html>";
$message->plainTextBody = "This is the Plain Text Body of my message sent to the recipient with %%EyeColor%% eyes.";
$message->from = new EmailAddress("[email protected]");
$message->replyTo = new EmailAddress("[email protected]");
//Add Bulk Recipients
$recipient1 = $message->addToAddress("[email protected]", "Recipient #1");
$recipient1->addMergeData("EyeColor", "Green");
$recipient2 = $message->addToAddress("[email protected]", "Recipient #2");
$recipient2->addMergeData("EyeColor", "Blue");
//Create the client and send the message
$response = $client->send($message);
```
<a name="managing-api-keys"></a>
## Managing API Keys
For ease of demonstration, many of our examples include the ServerId and API
key directly in our code sample. Generally it is not considered a good practice
to store sensitive information like this directly in your code.
<a name="examples-and-use-cases"></a>
# Examples and Use Cases
In order to demonstrate the many possible use cases for the SDK, we've provided
an assortment of code examples. These examples demonstrate many different
features available to the Injection API and SDK, including using templates
created in the [SocketLabs Email Designer](https://www.socketlabs.com/blog/introducing-new-email-designer/), custom email headers, sending
attachments, sending content that is stored in an HTML file, advanced bulk
merging, and even pulling recipients from a datasource.
### [Basic send example](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/Basic.php)
This example demonstrates a Basic Send.
### [Basic send complex example](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicComplexExample.php)
This example demonstrates many features of the Basic Send, including adding multiple recipients, adding message and mailing id's, and adding an embedded image.
### [Basic send from HTML file](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicFromHtmlFile.php)
This example demonstrates how to read in your HTML content from an HTML file
rather than passing in a string directly.
### [Basic send from SocketLabs API Template](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithApiTemplate.php)
This example demonstrates the sending of a piece of content that was created in the
SocketLabs Email Designer. This is also known as the [API Templates](https://www.socketlabs.com/blog/introducing-api-templates/) feature.
### [Basic send with specified character set](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithAsciiCharset.php)
This example demonstrates sending with a specific character set.
### [Basic send with file attachment](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithAttachment.php)
This example demonstrates how to add a file attachment to your message.
### [Basic send with custom email headers](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithCustomHeaders.php)
This example demonstrates how to add custom headers to your email message.
### [Basic send with embedded image](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithEmbeddedImage.php)
This example demonstrates how to embed an image in your message.
### [Basic send with a web proxy](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithProxy.php)
This example demonstrates how to use a proxy with your HTTP client.
### [Basic send with retry enabled](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/BasicWithRetry.php)
This example demonstrates how to use the retry logic with your HTTP client.
### [Basic send with Amp ](https://github.com/socketlabs/socketlabs-php/blob/main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAmpBody.php)
This example demonstrates how to send a basic message with an AMP Html body.
For more information about AMP please see [AMP Project](https://amp.dev/documentation/)
### [Basic send with invalid file attachment](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidAttachment.php)
This example demonstrates the results of attempting to do a send with an invalid attachment.
### [Basic send with invalid from address](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidFrom.php)
This example demonstrates the results of attempting to do a send with an invalid from address.
### [Basic send with invalid recipients](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidRecipients.php)
This example demonstrates the results of attempting to do a send with invalid recipients.
### [Bulk send with multiple recipients](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Bulk/Bulk.php)
This example demonstrates how to send a bulk message to multiple recipients.
### [Bulk send with complex merge including attachments](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Bulk/BulkComplexExample.php)
This example demonstrates many features of the `BulkMessage()`, including
adding multiple recipients, merge data, and adding an attachment.
### [Bulk send with recipients pulled from a datasource](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Bulk/BulkFromDataSourceWithMerge.php)
This example uses a mock repository class to demonstrate how you would pull
your recipients from a database and create a bulk mailing with merge data.
### [Bulk send with Ascii charset and special characters](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAsciiCharsetMergeData.php)
This example demonstrates how to send a bulk message with a specified character
set and special characters.
### [Bulk send with merge data](https://github.com/socketlabs/socketlabs-php/blob/master/InjectionApi/Examples/ExampleCode/Bulk/BulkWithMergeData.php)
This example demonstrates how to send a bulk message to multiple recipients with
unique merge data per recipient.
### [Bulk send with Amp ](https://github.com/socketlabs/socketlabs-php/blob/main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAmpBody.php )
This example demonstrates how to send a bulk message with an AMP Html body.
For more information about AMP please see [AMP Project](https://amp.dev/documentation/)
<a name="version"></a>
# Version
* 1.4.5 - Adding error handling on RetryHandler
* 1.4.4 - Removed Debugging Code
* 1.4.3 - Added MetadataOrTagsAreTooLarge error messsage
* 1.4.2 - Adding API Key Authorization
* 1.4.0 - Adding Metadata and Tags
* 1.2.1 - Adding optional retry logic for Http requests. If configured, the request will retry when certain 500 errors occur (500, 502, 503, 504)
* 1.1.2 - Add support of PHP 8.0
* 1.1.1 - Adding request timeout value on the client for Http requests
* 1.1.0 - Adds Amp Html Support
* 1.0.0 - Initial Release
<a name="license"></a>
# License
The SocketLabs.EmailDelivery library and all associated code, including any code samples, are [MIT Licensed](https://github.com/socketlabs/socketlabs-php/blob/master/LICENSE.MD).
@@ -0,0 +1,47 @@
{
"name": "socketlabs/email-delivery",
"type": "library",
"description": "SocketLabs Email Delivery PHP Client Library ",
"keywords": [
"socketlabs",
"email",
"deliverability",
"transactional-email"
],
"homepage": "https://github.com/socketlabs/socketlabs-php",
"license": "MIT",
"authors": [
{
"name": "SocketLabs",
"email": "[email protected]",
"homepage": "https://www.socketlabs.com",
"role": "Developer"
},
{
"name": "Bernie Harrison",
"email": "[email protected]",
"homepage": "https://www.socketlabs.com",
"role": "Developer"
},
{
"name": "Praneeth Chandra",
"email": "[email protected]",
"homepage": "https://www.socketlabs.com",
"role": "Developer/Contributor"
},
{
"name": "Mike Boshuyzen",
"email": "[email protected]",
"homepage": "https://www.socketlabs.com",
"role": "Developer"
}
],
"require": {
"php": ">=5.6"
},
"autoload": {
"psr-4": {
"Socketlabs\\": "InjectionApi/src/"
}
}
}
+19
View File
@@ -0,0 +1,19 @@
{
"_readme": [
"This file locks the dependencies of your project to a known state",
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "fb7601491f15060fb5e5a78ea697701e",
"packages": [],
"packages-dev": [],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
"prefer-stable": false,
"prefer-lowest": false,
"platform": {
"php": "^5.6.0 || ^7.0"
},
"platform-dev": []
}