-
-
Save dskarataev/db9893ff1690b031718d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Script to send an email using Experian UMS with attachments | |
*/ | |
$url = 'http://sysmail.fagms.net/c/tm?ACTION=SYSTEM'; | |
$file = 'test.png'; | |
$aid = 000000; // Replace with your ID | |
$email = '...'; // Replace with your email | |
file_put_contents($file, base64_decode(test_png())); | |
$params = []; | |
$params['AID'] = $aid; | |
$params['email'] = $email; | |
$params['systemmail_attachment_1'] = curl_file_create($file, mime_content_type($file), basename($file)); | |
$ch = curl_init(); | |
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data')); | |
curl_setopt($ch, CURLOPT_URL, $url); | |
curl_setopt($ch, CURLOPT_POST, 1); | |
curl_setopt($ch, CURLOPT_POSTFIELDS, $params); | |
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); | |
curl_setopt($ch, CURLOPT_HEADER, 1); | |
$response = curl_exec($ch); | |
print_r($response); | |
function curl_file_create($filename, $mimetype = '', $postname = '') | |
{ | |
return "@$filename;filename=" | |
. ($postname ?: basename($filename)) | |
. ($mimetype ? ";type=$mimetype" : ''); | |
} | |
function test_png() | |
{ | |
return <<<PNG | |
iVBORw0KGgoAAAANSUhEUgAAABkAAAAMCAYAAACX8hZLAAAABHNCSVQICAgIfAhkiAAAAmdJREFU | |
OI2tkl1MzWEcx7/P8T86dViOYophjSkjtbzEZriIXmYs7tx0IVtrc8EwE5OXC9xkyGbMe7PFZjop | |
hJFiK2xlyuZClkjN0os653TOx8WhTmWu+m7PxbPf8/18n32fxwBI0mBPv6zJ4RpP/WXaJOndmZ1a | |
nHptXANCmTZJaiwuUbvXP64hoUyr5ekDve31yhd4J7fbrZXpmYqybPJ72lRx262m1m5FxyUqOztN | |
kRPMMIVB1T0qU/37j/JYLiWvztSaJbGSpNFMlW5eR5zDwnLMJiUlhboeL13NJSS6HETELiR9YxaL | |
ZkQweW4a1T8GCMpPwfo52J1zWL9xMxlrk7AZQ9bhGgBGMwVQEh+Fa965oD/gISM6nNi1B+nw+oNI | |
bzt5CS6mJR8DoLetGElcbOnmr2qOphAZk4wnENyHMseEdLcUIomTn4cBAF9rt2CMobHPR3/nXSSx | |
Iu8E1Q2fCHIDI87/N6T1yQYkEe504gxdEXYkUfSlB4Dywm1MsWxIYlLMArbm7uNhU9c/Q6zRv8I2 | |
0SZJulBRpfjwMWPNio6QJGUeuqGO3af0tLJCVVVVuld6WhlXr8j9rUXprrCRJoBbCcOpfd8uI4mc | |
Z20j63p2hNz8XbR6Bul8fZ4dOdvxhTTU31mOJDKqg75QpgDur4rBMTWd569e0unzs3/ZdMIil3P9 | |
RTMDfj+tb8pInRJGdNLePw9/GcsYso7focvrJzDYR2VRNsbYufm9j9FMAXx5fGCo34JPP/H9+sDO | |
TUuxG4OZYDDGsCgtl4Ye79DNa8/mM9NpxxgLu83giJrPnkv1Q/NQ5m9zzB8t+VNJsAAAAABJRU5E | |
rkJggg== | |
PNG; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment