commit c41e56d382227135fbec4403c58f9ec4006b748c Author: unknown Date: Fri Oct 16 15:41:56 2026 +0300 start of git dir diff --git a/admin1.php b/admin1.php new file mode 100644 index 0000000..1356e47 --- /dev/null +++ b/admin1.php @@ -0,0 +1,211 @@ +prepare("SELECT usersname FROM users WHERE usersname = ? "); +$stmt -> bind_param("s",$customername); +$stmt -> execute(); +$stmt->store_result(); +if($stmt->num_rows == 0){ +$hashed = password_hash($customerpass, PASSWORD_DEFAULT); +$priv = "spectator"; +$stmt = $mysqli->prepare("INSERT INTO users (usersname,userspass,userspriv,usersphone,usersemail) VALUES (?,?,?,?,?)"); + $stmt->bind_param("sssss", $customername,$hashed,$priv,$customerphone,$customeremail); + $stmt->execute(); +} + + +mkdir("uploads/".$customername); +$customerview = "http://localhost/imageGalleryv2/kirjaudu.php"; + +// Configure upload directory and allowed file types +$upload_dir = "uploads/".$customername.'/'; +$allowed_types = array('jpg', 'png', 'jpeg', 'gif'); + +// Define maxsize for files i.e 2MB +$maxsize = 2 * 10024 * 10024; + +//checks if directory exist before continuen +if(is_dir("uploads/".$customername)){ +// Checks if user sent an empty form + if(!empty(array_filter($_FILES['files']['name']))) { + + // Loop through each file in files[] array + foreach ($_FILES['files']['tmp_name'] as $key => $value) { + + $file_tmpname = $_FILES['files']['tmp_name'][$key]; + $file_name = $_FILES['files']['name'][$key]; + $file_size = $_FILES['files']['size'][$key]; + $file_ext = pathinfo($file_name, PATHINFO_EXTENSION); + + // Set upload file path + $filepath = $upload_dir.$file_name; + + // Check file type is allowed or not + if(in_array(strtolower($file_ext), $allowed_types)) { + + // If file with name already exist then append time in + // front of name of the file to avoid overwriting of file + if(file_exists($filepath)) { + $filepath = $upload_dir.time().$file_name; + + if( move_uploaded_file($file_tmpname, $filepath)) { + + $urls = $upload_dir.$file_name; + $stmt = $mysqli->prepare("INSERT INTO images (imagesusers,imagesurls,imagesname) VALUES (?,?,?)"); + $stmt->bind_param("sss", $customername,$urls,$file_name); + $stmt->execute(); + echo "{$file_name} successfully uploaded
"; + //echo($customername); + // header("Location: admin1.php"); + + + } + else { + echo "Error uploading {$file_name}
"; + } + } + else { + + if( move_uploaded_file($file_tmpname, $filepath)) { + + $urls = $upload_dir."/".$file_name; +//resize picture on upload dont see any reason to keep original picturefiles on server at this moment + $source = imagecreatefromjpeg($urls); +list($width, $height) = getimagesize($urls); + +// Define new dimensions +/*$newWidth = 400; +$newHeight = 400; +*/ + +$newWidth = $width / 20; +$newHeight = $height / 20; +// Create a blank true-color image +$thumb = imagecreatetruecolor($newWidth, $newHeight); + +// Resize and copy +imagecopyresized($thumb, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); + +// Save output +imagejpeg($thumb, $urls, 80); + +// Free up memory +imagedestroy($source); +imagedestroy($thumb); + //image is resized next step watermark + +// Ladataan pääkuva ja vesileimalogo +$mainImg = imagecreatefromjpeg($urls); +$watermark = imagecreatefrompng('raccoon.png'); + +// Haetaan kuvien mitat +$mainWidth = imagesx($mainImg); +$mainHeight = imagesy($mainImg); +$watermarkWidth = imagesx($watermark); +$watermarkHeight = imagesy($watermark); + +// Lasketaan sijainti (oikea alakulma, 20px marginaali) +$dstX = $mainWidth - $watermarkWidth - 20; +$dstY = $mainHeight - $watermarkHeight - 20; + +// Kopioidaan vesileima pääkuvan päälle säilyttäen alfa-kanava (läpinäkyvyys) +imagecopy($mainImg, $watermark, $dstX, $dstY, 0, 0, $watermarkWidth, $watermarkHeight); + +// Tallennetaan valmis kuva +imagejpeg($mainImg, $urls, 90); + +// Vapautetaan muisti +imagedestroy($mainImg); +imagedestroy($watermark); + + + //$urls = "images/".$file_name; + $stmt = $mysqli->prepare("INSERT INTO images (imagesusers,imagesurls,imagesname) VALUES (?,?,?)"); + $stmt->bind_param("sss", $customername,$urls,$file_name); + $stmt->execute(); + echo "{$file_name} successfully uploaded
"; + //echo($customername); + // header("Location: admin1.php"); + + // $_POST["files[]"] = ""; + + } + else { + echo "Error uploading {$file_name}
"; + } + } + } + else { + + // If file extension not valid + echo "Error uploading {$file_name} "; + echo "({$file_ext} file type is not allowed)
"; + } + } + } + else { + + // If no files selected + echo "No files selected."; + } + + }else{ + echo("dir doesnt exist"); + } + echo("
"); + echo("osoite: ".$customerview . "
"); + echo("Käyttäjä: ". $customername . "
"); + echo("Salasana: ". $customerpass); +} + +?> + + + + + + + + Document + + + + + +
+ +

Upload Files

+ + + + + +
+ +
+ +
+ + +

+ Valitse tiedostot +

+ + +

+ + + + +
+ + \ No newline at end of file diff --git a/db.php b/db.php new file mode 100644 index 0000000..1464570 --- /dev/null +++ b/db.php @@ -0,0 +1,22 @@ +connect_errno){ + die("connection failed:" . mysqli_connect_error()); +} + + + + + + + diff --git a/image.php b/image.php new file mode 100644 index 0000000..4fec3cf --- /dev/null +++ b/image.php @@ -0,0 +1,141 @@ + $value) { + + $file_tmpname = $_FILES['files']['tmp_name'][$key]; + $file_name = $_FILES['files']['name'][$key]; + $file_size = $_FILES['files']['size'][$key]; + $file_ext = pathinfo($file_name, PATHINFO_EXTENSION); + + // Set upload file path + $filepath = $upload_dir.$file_name; + + // Check file type is allowed or not + if(in_array(strtolower($file_ext), $allowed_types)) { + + // If file with name already exist then append time in + // front of name of the file to avoid overwriting of file + if(file_exists($filepath)) { + $filepath = $upload_dir.time().$file_name; + + if( move_uploaded_file($file_tmpname, $filepath)) { + + $urls = $upload_dir.$file_name; + $stmt = $mysqli->prepare("INSERT INTO images (imagesusers,imagesurls,imagesname) VALUES (?,?,?)"); + $stmt->bind_param("sss", $customername,$urls,$file_name); + $stmt->execute(); + echo "{$file_name} successfully uploaded
"; + //echo($customername); + // header("Location: admin1.php"); + + + } + else { + echo "Error uploading {$file_name}
"; + } + } + else { + + if( move_uploaded_file($file_tmpname, $filepath)) { + + $urls = $upload_dir."/".$file_name; +//resize picture on upload dont see any reason to keep original picturefiles on server at this moment + $source = imagecreatefromjpeg($urls); +list($width, $height) = getimagesize($urls); + +// Define new dimensions +$newWidth = 600; +$newHeight = 600; + +// Create a blank true-color image +$thumb = imagecreatetruecolor($newWidth, $newHeight); + +// Resize and copy +imagecopyresized($thumb, $source, 0, 0, 0, 0, $newWidth, $newHeight, $width, $height); + +// Save output +imagejpeg($thumb, $urls, 50); + +// Free up memory +imagedestroy($source); +imagedestroy($thumb); + //image is resized next step watermark + +// Ladataan pääkuva ja vesileimalogo +$mainImg = imagecreatefromjpeg($urls); +$watermark = imagecreatefrompng('raccoon.png'); + +// Haetaan kuvien mitat +$mainWidth = imagesx($mainImg); +$mainHeight = imagesy($mainImg); +$watermarkWidth = imagesx($watermark); +$watermarkHeight = imagesy($watermark); + +// Lasketaan sijainti (oikea alakulma, 20px marginaali) +$dstX = $mainWidth - $watermarkWidth - 20; +$dstY = $mainHeight - $watermarkHeight - 20; + +// Kopioidaan vesileima pääkuvan päälle säilyttäen alfa-kanava (läpinäkyvyys) +imagecopy($mainImg, $watermark, $dstX, $dstY, 0, 0, $watermarkWidth, $watermarkHeight); + +// Tallennetaan valmis kuva +imagejpeg($mainImg, $urls, 90); + +// Vapautetaan muisti +imagedestroy($mainImg); +imagedestroy($watermark); + + + //$urls = "images/".$file_name; + $stmt = $mysqli->prepare("INSERT INTO images (imagesusers,imagesurls,imagesname) VALUES (?,?,?)"); + $stmt->bind_param("sss", $customername,$urls,$file_name); + $stmt->execute(); + echo "{$file_name} successfully uploaded
"; + //echo($customername); + // header("Location: admin1.php"); + + // $_POST["files[]"] = ""; + + } + else { + echo "Error uploading {$file_name}
"; + } + } + } + else { + + // If file extension not valid + echo "Error uploading {$file_name} "; + echo "({$file_ext} file type is not allowed)
"; + } + } + } + else { + + // If no files selected + echo "No files selected."; + } + + }else{ + echo("dir doesnt exist"); + } + echo($customerview); +} \ No newline at end of file diff --git a/index.php b/index.php new file mode 100644 index 0000000..7547e3c --- /dev/null +++ b/index.php @@ -0,0 +1,33 @@ + $max_width) { + $ratio = $old_width / $max_width; + $new_width = $max_width; + $new_height = (int) round($old_height / $ratio); +} else { + $new_width = $old_width; + $new_height = $old_height; +} + +//echo "New dimensions: {$new_width} x {$new_height}"; + +$new_image = imagecreatetruecolor($new_width, $new_height); +$old_image = imagecreatefromjpeg($file); + +imagecopyresampled($new_image, $old_image, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height); + +// Tell the browser this script returns a JPEG image +header('Content-Type: image/jpeg'); + +// Output the image stream directly to the browser +imagejpeg($new_image, null, 90); // 90 = quality percentage (0-100) + +imagedestroy($old_image); +imagedestroy($new_image); diff --git a/kirjaudu.php b/kirjaudu.php new file mode 100644 index 0000000..877b758 --- /dev/null +++ b/kirjaudu.php @@ -0,0 +1,58 @@ +prepare("SELECT usersname FROM users WHERE usersname = ? "); +$stmt -> bind_param("s",$username); +$stmt -> execute(); +$stmt->store_result(); +if($stmt->num_rows > 0){ + +$stmt = $mysqli->prepare("SELECT idusers, usersname, userspass FROM users WHERE usersname = ?"); +$stmt->bind_param("s", $username); +$stmt->execute(); +$result = $stmt->get_result(); + +if ($row = $result->fetch_assoc()) { + // Verify the submitted password against the securely hashed password in DB + if (password_verify($password, $row['userspass'])) { + + $_SESSION["id"] = $row["idusers"]; + $_SESSION["user"] = $row["usersname"]; + header("Location:kuvat.php?kuvat=".$row["usersname"]); + + } else { + echo "Invalid Username/Password."; + } +} +}else{echo("no");} + + + +} + +?> + + + + + + + + Document + + +
+
+ + + + + +
+
+ + \ No newline at end of file diff --git a/kuva1.jpg b/kuva1.jpg new file mode 100644 index 0000000..be26e87 Binary files /dev/null and b/kuva1.jpg differ diff --git a/kuvat.jpg b/kuvat.jpg new file mode 100644 index 0000000..3c140c2 Binary files /dev/null and b/kuvat.jpg differ diff --git a/kuvat.php b/kuvat.php new file mode 100644 index 0000000..2de6c06 --- /dev/null +++ b/kuvat.php @@ -0,0 +1,150 @@ +prepare("SELECT usersname FROM users WHERE idusers = ? AND usersname = ? "); +$stmt -> bind_param("ss",$id,$username); +$stmt -> execute(); +$result = $stmt->get_result(); +$stmt->store_result(); + + + +if ($row = $result->fetch_assoc()) { + // Verify the submitted password against the securely hashed password in DB + $checkuser=$row["usersname"]; + } + else +{echo("warning");} + +$customer=htmlspecialchars($_GET["kuvat"]); + +if($customer === $checkuser){ + $stmt = $mysqli ->prepare("SELECT imagesurls,imagesname FROM images WHERE imagesusers = ? "); +$stmt -> bind_param("s",$customer); +$stmt -> execute(); +$result = $stmt->get_result(); +$images = array(); +while($row = mysqli_fetch_assoc($result)){ + $images[] = $row; +} + +}else{echo("warning"); +exit;} + + + + + +?> + + + + + + + + + Document + +
+
+
+ +
+ +
+
+ + + +
+ " alt="" > +

+

+ + + + + + \ No newline at end of file diff --git a/order.php b/order.php new file mode 100644 index 0000000..5847e9e --- /dev/null +++ b/order.php @@ -0,0 +1,49 @@ +subject = "Test Message"; +$message->htmlBody = "

".$receivedVariable."

"; +$message->plainTextBody = "Test email body"; + +// Ensure this From address uses your verified domain in SocketLabs! +$message->from = new EmailAddress("no-reply@modify.fi"); +$message->addToAddress("lassi.lyhtela@modify.fi"); + +try { + $response = $client->send($message); + if($response->result == "Success"){ + echo("Tilaus lähetetty"); + echo "Received variable: " . $receivedVariable; + + } + +} catch (Exception $e) { + echo "Caught exception: " . $e->getMessage(); +} + + +} else { + echo "No data received"; +} + + +/*ini_set('display_errors', 1); +error_reporting(E_ALL); +*/ diff --git a/raccoon.png b/raccoon.png new file mode 100644 index 0000000..6845946 Binary files /dev/null and b/raccoon.png differ diff --git a/socketlabs-php-main/socketlabs-php-main/.gitignore b/socketlabs-php-main/socketlabs-php-main/.gitignore new file mode 100644 index 0000000..e4f1a8e --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/.gitignore @@ -0,0 +1,3 @@ +/.vscode/commandbar.json +/.vscode +/vendor/* diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/VSWorkspaceState.json b/socketlabs-php-main/socketlabs-php-main/.vs/VSWorkspaceState.json new file mode 100644 index 0000000..56807f3 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/.vs/VSWorkspaceState.json @@ -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 +} \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/slnx.sqlite b/socketlabs-php-main/socketlabs-php-main/.vs/slnx.sqlite new file mode 100644 index 0000000..81bc56e Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/slnx.sqlite differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/087772e8-1259-4e99-b075-58c404dda629.vsidx b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/087772e8-1259-4e99-b075-58c404dda629.vsidx new file mode 100644 index 0000000..348f256 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/087772e8-1259-4e99-b075-58c404dda629.vsidx differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/4efe6bc9-c0b5-431a-b76d-421956624cd4.vsidx b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/4efe6bc9-c0b5-431a-b76d-421956624cd4.vsidx new file mode 100644 index 0000000..dca4bb0 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/4efe6bc9-c0b5-431a-b76d-421956624cd4.vsidx differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/ce21c6de-b9f7-48c3-9032-b53cea62b872.vsidx b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/ce21c6de-b9f7-48c3-9032-b53cea62b872.vsidx new file mode 100644 index 0000000..41c77cd Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/ce21c6de-b9f7-48c3-9032-b53cea62b872.vsidx differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/d38cfa93-a382-4660-bebd-474f9477f27f.vsidx b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/d38cfa93-a382-4660-bebd-474f9477f27f.vsidx new file mode 100644 index 0000000..2d5f165 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/d38cfa93-a382-4660-bebd-474f9477f27f.vsidx differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/read.lock b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/FileContentIndex/read.lock new file mode 100644 index 0000000..e69de29 diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/config/applicationhost.config b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/config/applicationhost.config new file mode 100644 index 0000000..600d758 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/config/applicationhost.config @@ -0,0 +1,972 @@ + + + + + + +
+
+
+
+
+
+
+
+ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+ +
+
+
+
+
+
+ +
+
+
+
+
+ +
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+
+
+
+
+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/.suo b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/.suo new file mode 100644 index 0000000..a9d5997 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/.suo differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/000.testlog b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/000.testlog new file mode 100644 index 0000000..062657a Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/000.testlog differ diff --git a/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/testlog.manifest b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/testlog.manifest new file mode 100644 index 0000000..e92ede2 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/.vs/socketlabs-php/v17/TestStore/0/testlog.manifest differ diff --git a/socketlabs-php-main/socketlabs-php-main/CONTRIBUTING.md b/socketlabs-php-main/socketlabs-php-main/CONTRIBUTING.md new file mode 100644 index 0000000..b5e7374 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/CONTRIBUTING.md @@ -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) + + +## 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. + +## 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. + + ## 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. diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Basic.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Basic.php new file mode 100644 index 0000000..88ec2a2 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Basic.php @@ -0,0 +1,24 @@ +subject = "Sending A Basic Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; + +$message->from = new EmailAddress("from@example.com"); +$message->replyTo = new EmailAddress("replyto@example.com"); + +//A basic message supports up to 50 recipients and supports several different ways to add recipients +$message->addToAddress("recipient1@example.com"); //Add a To address by passing the email address +$message->addCcAddress("recipient2@example.com", "Recipient #2"); //Add a CC address by passing the email address and a friendly name +$message->addBccAddress(new EmailAddress("recipient3@example.com")); //Add a BCC address by passing an EmailAddress object + +$response = $client->send($message); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicComplexExample.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicComplexExample.php new file mode 100644 index 0000000..bc9c6a6 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicComplexExample.php @@ -0,0 +1,62 @@ +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("from@example.com", "from"); +$message->to[] = new EmailAddress("recipient@example.com", "recipient name"); +$message->cc[] = new EmailAddress("cc@example.com", "cc name"); +$message->bcc[] = new EmailAddress("bcc@example.com", "bcc name"); + +//Set reply to +$message->replyTo = new EmailAddress("replyto@example.com", "Reply Address"); + +//set html and text body parts +$message->htmlBody = "

Lorem Ipsum


"; +$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); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicFromHtmlFile.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicFromHtmlFile.php new file mode 100644 index 0000000..6aeb7c6 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicFromHtmlFile.php @@ -0,0 +1,23 @@ +subject = "Simple Html file with text"; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "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); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAmpBody.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAmpBody.php new file mode 100644 index 0000000..0232a17 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAmpBody.php @@ -0,0 +1,36 @@ +subject = "Sending a Message with ampBody support"; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1")); + +//Pass in the htmlBody with ampBody support +$message->htmlBody = "

Sending A Test Message

This HTML will show if AMP is not supported.

"; +$message->ampBody = "" + +"" + +"" + +" " + +" " + +" " + +" " + +"" + +"" + +"

This is the AMP Html Body of my message

" + +"" + +""; + +$response = $client->send($message); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithApiTemplate.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithApiTemplate.php new file mode 100644 index 0000000..fc20ce5 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithApiTemplate.php @@ -0,0 +1,20 @@ +subject = "Sending Using a Template"; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1")); + +//Pass in the ID of the template to use as the htmlBody +$message->apiTemplate = 1; + +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAsciiCharset.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAsciiCharset.php new file mode 100644 index 0000000..8727671 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAsciiCharset.php @@ -0,0 +1,24 @@ +subject = "Sending An ASCII Charset Email"; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1")); +$message->plainTextBody = "Lorem Ipsum"; + +//Set the character set +$message->charset = "ASCII"; + +//Use the character set (✔) +$message->htmlBody = "Lorem IpsumUnicode: ✔ - Check"; + +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAttachment.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAttachment.php new file mode 100644 index 0000000..18c818a --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithAttachment.php @@ -0,0 +1,27 @@ +subject = "Sending A Test Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithCustomHeaders.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithCustomHeaders.php new file mode 100644 index 0000000..c25b2e5 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithCustomHeaders.php @@ -0,0 +1,36 @@ +subject = "Sending An Email With Custom Headers"; +$message->htmlBody = "Lorem Ipsum"; +$message->plainTextBody = "Lorem Ipsum"; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "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); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithEmbeddedImage.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithEmbeddedImage.php new file mode 100644 index 0000000..9a1b242 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithEmbeddedImage.php @@ -0,0 +1,25 @@ +subject = "Sending an Email With An Embedded Image"; +$message->plainTextBody = "Lorem Ipsum"; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "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 = "

Lorem Ipsum


"; + +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithProxy.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithProxy.php new file mode 100644 index 0000000..cabebe1 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithProxy.php @@ -0,0 +1,21 @@ +proxyUrl = exampleConfig::proxy(); + +//Build the message +$message = new BasicMessage(); + +$message->subject = "Sending A Test Message Through Proxy"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1")); + +//Send the message +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithRetry.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithRetry.php new file mode 100644 index 0000000..a9deb4e --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/BasicWithRetry.php @@ -0,0 +1,25 @@ +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 = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com", "Recipient #1")); + +//Send the message +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidAttachment.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidAttachment.php new file mode 100644 index 0000000..22dfa94 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidAttachment.php @@ -0,0 +1,25 @@ +subject = "Sending A Test Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); +$message->addToAddress(new EmailAddress("recipient1@example.com")); + +//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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidFrom.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidFrom.php new file mode 100644 index 0000000..45bc5ea --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidFrom.php @@ -0,0 +1,22 @@ +subject = "Sending A Test Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->addToAddress(new EmailAddress("recipient1@example.com")); + +//Invalid email address +$message->from = new EmailAddress("!@#$!@#$!@#$@#!$"); + + +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidRecipients.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidRecipients.php new file mode 100644 index 0000000..8c5c64d --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Basic/Invalid/BasicWithInvalidRecipients.php @@ -0,0 +1,29 @@ +subject = "Sending A Test Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new EmailAddress("from@example.com"); + +//Valid +$message->addToAddress(new EmailAddress("this@works")); +$message->addToAddress(new EmailAddress("recipient@example.com")); + + //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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/Bulk.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/Bulk.php new file mode 100644 index 0000000..1a7249e --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/Bulk.php @@ -0,0 +1,25 @@ +subject = "Sending A Test Message"; +$message->htmlBody = "This is the Html Body of my message."; +$message->plainTextBody = "This is the Plain Text Body of my message."; +$message->from = new BulkRecipient("from@example.com"); +$message->replyTo = new BulkRecipient("replyto@example.com"); + +//Add Bulk Recipients +$message->addToAddress (new BulkRecipient("recipient1@example.com", "Recipient #1")); +$message->addToAddress (new BulkRecipient("recipient2@example.com", "Recipient #2")); +$message->addToAddress (new BulkRecipient("recipient3@example.com", "Recipient #3")); +$message->addToAddress (new BulkRecipient("recipient4@example.com", "Recipient #4")); + +$response = $client->send($message); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkComplexExample.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkComplexExample.php new file mode 100644 index 0000000..003a5f5 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkComplexExample.php @@ -0,0 +1,86 @@ +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("recipient1@example.com"); +$recipient1->addMergeData("Birthday", "08/05/1991"); +$recipient1->addMergeData("Age", "27"); +$message->addToAddress($recipient1); + +$recipient2 = new BulkRecipient("recipient2@example.com"); +$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("recipient3@example.com", "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("from@example.com", "FromMe"); +$message->replyTo = new EmailAddress("replyto@example.com"); + +//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 = "" . + "Complex" . + "" . + "

Merged Data

" . + "

" . + "Motto = %%Motto%%
" . + "Birthday = %%Birthday%%
" . + "Age = %%Age%%
" . + "UpSell = %%UpSell%%
" . + "

" . + "
" . + "

Example of Merge Usage

" . + "

" . + "Our company motto is '%%Motto%%'.
" . + "Your birthday is %%Birthday%% and you are %%Age%% years old.
" . + "
" . + "%%UpSell%%" . + "

" . + "" . + ""; + +$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); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkFromDataSourceWithMerge.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkFromDataSourceWithMerge.php new file mode 100644 index 0000000..735910d --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkFromDataSourceWithMerge.php @@ -0,0 +1,49 @@ +subject = "Hello %%FirstName%%"; +$message->from = new EmailAddress("from@example.com"); +$message->ReplyTo = new EmailAddress("replyto@example.com"); + +$message->htmlBody = "" . + "Data Source Merge Data Example" . + "" . + "

Sending A Test Message With Merge Data From Datasource

" . + "

Hello %%FirstName%% %%LastName%%.

" . + "

Is your favorite color still %%FavoriteColor%%?

" . + "" . + ""; + +$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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAmpBody.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAmpBody.php new file mode 100644 index 0000000..17303ee --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAmpBody.php @@ -0,0 +1,40 @@ +subject = "Sending A Bulk Message with ampBody"; +$message->htmlBody = "This is the Html Body of my message."; +$message->ampBody = "" + +"" + +"" + +" " + +" " + +" " + +" " + +"" + +"" + +"

This is the AMP Html Body of the message

" + +"" + +""; +$message->from = new BulkRecipient("from@example.com"); +$message->replyTo = new BulkRecipient("replyto@example.com"); + +//Add Bulk Recipients +$message->addToAddress (new BulkRecipient("recipient1@example.com", "Recipient #1")); +$message->addToAddress (new BulkRecipient("recipient2@example.com", "Recipient #2")); +$message->addToAddress (new BulkRecipient("recipient3@example.com", "Recipient #3")); +$message->addToAddress (new BulkRecipient("recipient4@example.com", "Recipient #4")); + +$response = $client->send($message); diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAsciiCharsetMergeData.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAsciiCharsetMergeData.php new file mode 100644 index 0000000..9e31742 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithAsciiCharsetMergeData.php @@ -0,0 +1,45 @@ +subject = "Sending A Test Message"; +$message->from = new BulkRecipient("from@example.com"); + +//Set the content to use MergeData +$message->htmlBody = "" . + "ASCII Merge Data Example" . + "" . + "

Merge Data

" . + "

Complete? = %%Complete%%

" . + "" . + ""; +$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("recipient1@example.com", "Recipient #1"); +$recipient1->addMergeData("Complete", "✔"); + +$recipient2 = new BulkRecipient("recipient2@example.com", "Recipient #2"); +$recipient2->addMergeData("Complete", "✔"); + +$recipient3 = new BulkRecipient("recipient3@example.com"); +$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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithMergeData.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithMergeData.php new file mode 100644 index 0000000..c2cd426 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Bulk/BulkWithMergeData.php @@ -0,0 +1,57 @@ +subject = "Sending A BulkSend with MergeData"; +$message->from = new EmailAddress("from@example.com"); + +//Build the Content (Note the %% symbols used to denote the data to be merged) +$message->htmlBody = "" . + "Merge Data Example" . + "" . + "

Global Merge Data

" . + "

CompanyMotto = %%Motto%%

" . + "

Per Recipient Merge Data

" . + "

EyeColor = %%EyeColor%%

" . + "

HairColor = %%HairColor%%

" . + "" . + ""; + +$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("recipient1@example.com", "Recipient #1"); +$recipient1->addMergeData("EyeColor", "Blue"); +$recipient1->addMergeData("HairColor", "Blond"); + +$recipient2 = new BulkRecipient("recipient2@example.com", "Recipient #2"); +$recipient1->addMergeData("EyeColor", "Green"); +$recipient1->addMergeData("HairColor", "Brown"); + +$recipient3 = new BulkRecipient("recipient3@example.com", "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); \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/Customer.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/Customer.php new file mode 100644 index 0000000..48992a2 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/Customer.php @@ -0,0 +1,21 @@ +firstName = $firstName; + $this->lastName = $lastName; + $this->email = $email; + $this->favoriteColor = $favoriteColor; + } + +} \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/CustomerRepository.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/CustomerRepository.php new file mode 100644 index 0000000..e3aa88c --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/DataSource/CustomerRepository.php @@ -0,0 +1,22 @@ + + + + + + Lorem Ipsum + + +
+

Lorem Ipsum

+

The standard Lorem Ipsum passage, used since the 1500s

+

+ 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. +

+
    +
  1. Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
  2. +
  3. Aliquam tincidunt mauris eu risus.
  4. +
  5. Vestibulum auctor dapibus neque.
  6. +
+
+ + \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Img/bus.png b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Img/bus.png new file mode 100644 index 0000000..0b8bc73 Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Img/bus.png differ diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Includes.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Includes.php new file mode 100644 index 0000000..d3e3ff1 --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/ExampleCode/Includes.php @@ -0,0 +1,7 @@ + + + + + + + + + + + + + + + + + + + HOME + + + +
+
+
+
+
+ +
+
+

PHP SDK Example Runner

+
+
+
+
+
+
+ Select one of the following examples to see the Example Code, Message Values, and the Request/Response JSON: +
+ +
+
+
+ + +
+ +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/Js/Index.js b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/Js/Index.js new file mode 100644 index 0000000..f936fec --- /dev/null +++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/Js/Index.js @@ -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
 tags work properly
+            // exCode = exCode.replace(/[\n\r]/g, ''); 
+            // document.getElementById("codeExample").innerHTML = '
' + exCode + '
'; + + // // tab2 - Response JSON + // var respJson = data[3]; + // document.getElementById("responseJson").innerHTML = '
' + respJson + '
'; + var response = data.response + var respJson = JSON.stringify(response, null, 2); + $("#responseJson>textarea").html(respJson); + // document.getElementById("responseJson").innerHTML = '
' + respJson + '
'; + + // // tab3 - Request JSON + var request = data.request + var reqJson = JSON.stringify(request, null, 2); + $("#requestJson>textarea").html(reqJson); + // document.getElementById("requestJson").innerHTML = '
' + reqJson + '
'; + + // //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(/[\s\S]*?<\/small>/, '' + '' + '<\/small>'); + // document.getElementById("variableValues").innerHTML = varValues; //
 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 
 tags work properly
+            document.getElementById("codeExample").innerHTML = '
' + data + '
'; + }, + 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(/[\s\S]*?<\/small>/, '' + '' + '<\/small>'); + + document.getElementById("variableValues").innerHTML = data; //
 tags are already added by php
+        },
+        error: function (jqXHR, exception) {
+            alert("error: " + jqXHR.status);
+            alert("error: " + jqXHR.responseText);
+            alert("error: " + exception);
+        }
+    });
+};
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/DisplayExampleCode.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/DisplayExampleCode.php
new file mode 100644
index 0000000..cb24702
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/DisplayExampleCode.php
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/RunExampleCode.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/RunExampleCode.php
new file mode 100644
index 0000000..fc462cc
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/PHP/RunExampleCode.php
@@ -0,0 +1,25 @@
+
+generateRequest($message);
+
+        $response->responseMessage = $response->responseMessage;
+        $output = array("request"=>$request, "response"=>$response);
+        
+        header('Content-Type: application/json');
+        echo json_encode($output);
+    }
+?>
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/css/index.css b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/css/index.css
new file mode 100644
index 0000000..50376f3
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/css/index.css
@@ -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;
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/img/socketlabs-logo.png b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/img/socketlabs-logo.png
new file mode 100644
index 0000000..3bd080d
Binary files /dev/null and b/socketlabs-php-main/socketlabs-php-main/InjectionApi/Examples/Index/img/socketlabs-logo.png differ
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/AddressResult.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/AddressResult.php
new file mode 100644
index 0000000..2627dec
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/AddressResult.php
@@ -0,0 +1,22 @@
+
+        /// No result could be produced.
+        /// 
+        const None = "None";
+        /// 
+        /// The key was found to be the improper length.
+        /// 
+        const InvalidKeyLength = "InvalidKeyLength";
+        /// 
+        /// The key was found to be blank or invalid.
+        /// 
+        const InvalidEmptyOrWhitespace = "InvalidEmptyOrWhitespace";
+        /// 
+        /// The key was found to be blank or invalid.
+        /// 
+        const Invalid = "Invalid";
+        /// 
+        /// The public portion of the key was unable to be parsed.
+        /// 
+        const InvalidUnableToExtractPublicPart = "InvalidUnableToExtractPublicPart";
+        /// 
+        /// The secret portion of the key was unable to be parsed.
+        /// 
+        const InvalidUnableToExtractSecretPart = "InvalidUnableToExtractSecretPart";
+        /// 
+        /// The public portion of the key has an invalid length.
+        /// 
+        const InvalidPublicPartLength = "InvalidPublicPartLength";
+        /// 
+        /// The secret portion of the key has an invalid length.
+        /// 
+        const InvalidSecretPartLength = "InvalidSecretPartLength";
+        /// 
+        /// Key was successfully parsed.
+        /// 
+        const Success = "Success";
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/ApiKeyParser.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/ApiKeyParser.php
new file mode 100644
index 0000000..c707352
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/ApiKeyParser.php
@@ -0,0 +1,61 @@
+ServerId = (int)$serverId;
+        $this->ApiKey = $apiKey;
+
+        $this->Messages = array();
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionRequestFactory.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionRequestFactory.php
new file mode 100644
index 0000000..88f6582
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionRequestFactory.php
@@ -0,0 +1,280 @@
+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;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionResponseParser.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionResponseParser.php
new file mode 100644
index 0000000..427aa03
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/InjectionResponseParser.php
@@ -0,0 +1,102 @@
+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;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/RetryHandler.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/RetryHandler.php
new file mode 100644
index 0000000..6b75f26
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/RetryHandler.php
@@ -0,0 +1,58 @@
+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);
+    }
+
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/SendValidator.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/SendValidator.php
new file mode 100644
index 0000000..306f2e5
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/SendValidator.php
@@ -0,0 +1,413 @@
+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
+     * 
+     * @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 != "";
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AddressJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AddressJson.php
new file mode 100644
index 0000000..f6a0afb
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AddressJson.php
@@ -0,0 +1,29 @@
+EmailAddress = $emailAddress;
+        $this->FriendlyName = $friendlyName; 
+    } 
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AttachmentJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AttachmentJson.php
new file mode 100644
index 0000000..e7e30a4
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/AttachmentJson.php
@@ -0,0 +1,33 @@
+Name = $name;
+        $this->Value = $value; 
+    } 
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeDataJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeDataJson.php
new file mode 100644
index 0000000..c13ad7f
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeDataJson.php
@@ -0,0 +1,27 @@
+Global = array();
+        $this->PerMessage = array(array()); 
+    }
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeFieldJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeFieldJson.php
new file mode 100644
index 0000000..f39069e
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MergeFieldJson.php
@@ -0,0 +1,29 @@
+Field = $field;
+        $this->Value = $value;
+    }
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MessageJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MessageJson.php
new file mode 100644
index 0000000..bdfd601
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MessageJson.php
@@ -0,0 +1,105 @@
+MergeData = new MergeDataJson();
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MetadataJson.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MetadataJson.php
new file mode 100644
index 0000000..e846daf
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Core/Serialization/MetadataJson.php
@@ -0,0 +1,32 @@
+Key = $key;
+        $this->Value = $value;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Attachment.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Attachment.php
new file mode 100644
index 0000000..712ca4b
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Attachment.php
@@ -0,0 +1,215 @@
+ src="cid:contentId" 
+     * @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';
+    }
+
+
+}
+
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BaseMessage.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BaseMessage.php
new file mode 100644
index 0000000..214ddff
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BaseMessage.php
@@ -0,0 +1,150 @@
+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;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BasicMessage.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BasicMessage.php
new file mode 100644
index 0000000..4d72874
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BasicMessage.php
@@ -0,0 +1,78 @@
+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.");
+        }
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkMessage.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkMessage.php
new file mode 100644
index 0000000..bb7ec81
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkMessage.php
@@ -0,0 +1,61 @@
+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;
+    }
+
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkRecipient.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkRecipient.php
new file mode 100644
index 0000000..a74a220
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/BulkRecipient.php
@@ -0,0 +1,36 @@
+ $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;
+    }
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/CustomHeader.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/CustomHeader.php
new file mode 100644
index 0000000..59412d1
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/CustomHeader.php
@@ -0,0 +1,27 @@
+name = $name;
+        $this->value = $value;
+    }
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/EmailAddress.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/EmailAddress.php
new file mode 100644
index 0000000..203d245
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/EmailAddress.php
@@ -0,0 +1,48 @@
+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;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Metadata.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Metadata.php
new file mode 100644
index 0000000..919e619
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/Message/Metadata.php
@@ -0,0 +1,31 @@
+key = $key;
+        $this->value = $value;
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/RetrySettings.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/RetrySettings.php
new file mode 100644
index 0000000..07a9fec
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/RetrySettings.php
@@ -0,0 +1,45 @@
+ 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));
+    }
+
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResponse.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResponse.php
new file mode 100644
index 0000000..ba1123e
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResponse.php
@@ -0,0 +1,164 @@
+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");
+    }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResult.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResult.php
new file mode 100644
index 0000000..c67b25c
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/SendResult.php
@@ -0,0 +1,226 @@
+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,
+                        //)
+                );
+        }
+}
diff --git a/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php
new file mode 100644
index 0000000..6839362
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/InjectionApi/src/includes.php
@@ -0,0 +1,34 @@
+
+# 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).
+
+
+
+# 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 = "This is the Html Body of my message.";
+$message->plainTextBody = "This is the Plain Text Body of my message.";
+
+$message->from = new EmailAddress("from@example.com");
+$message->replyTo = new EmailAddress("replyto@example.com");
+
+//A basic message supports up to 50 recipients and supports several different ways to add recipients
+$message->addToAddress("recipient1@example.com"); //Add a To address by passing the email address
+$message->addCcAddress("recipient2@example.com", "Recipient #2"); //Add a CC address by passing the email address and a friendly name
+$message->addBccAddress(new EmailAddress("recipient3@example.com")); //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 = "This is the Html Body of my message sent to the recipient with %%EyeColor%% eyes.";
+$message->plainTextBody = "This is the Plain Text Body of my message sent to the recipient with %%EyeColor%% eyes.";
+$message->from = new EmailAddress("from@example.com");
+$message->replyTo = new EmailAddress("replyto@example.com");
+
+//Add Bulk Recipients
+$recipient1 = $message->addToAddress("recipient1@example.com", "Recipient #1");
+$recipient1->addMergeData("EyeColor", "Green");
+
+$recipient2 = $message->addToAddress("recipient2@example.com", "Recipient #2");
+$recipient2->addMergeData("EyeColor", "Blue");
+
+
+//Create the client and send the message
+$response = $client->send($message);
+
+```
+
+
+## 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.
+
+
+# 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/)
+
+
+
+# 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
+
+
+# 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).
diff --git a/socketlabs-php-main/socketlabs-php-main/composer.json b/socketlabs-php-main/socketlabs-php-main/composer.json
new file mode 100644
index 0000000..cfd97af
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/composer.json
@@ -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": "developers@socketlabs.com",
+            "homepage": "https://www.socketlabs.com",
+            "role": "Developer"
+        },
+        {
+            "name": "Bernie Harrison",
+            "email": "developers@socketlabs.com",
+            "homepage": "https://www.socketlabs.com",
+            "role": "Developer"
+        },
+        {
+            "name": "Praneeth Chandra",
+            "email": "developers@socketlabs.com",
+            "homepage": "https://www.socketlabs.com",
+            "role": "Developer/Contributor"
+        },
+        {
+            "name": "Mike Boshuyzen",
+            "email": "developers@socketlabs.com",
+            "homepage": "https://www.socketlabs.com",
+            "role": "Developer"
+        }
+    ],
+    "require": {
+        "php": ">=5.6"
+    },
+    "autoload": {
+        "psr-4": {
+            "Socketlabs\\": "InjectionApi/src/"
+        }
+    }
+}
\ No newline at end of file
diff --git a/socketlabs-php-main/socketlabs-php-main/composer.lock b/socketlabs-php-main/socketlabs-php-main/composer.lock
new file mode 100644
index 0000000..f37a562
--- /dev/null
+++ b/socketlabs-php-main/socketlabs-php-main/composer.lock
@@ -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": []
+}
diff --git a/styles/Modify_logo_musta.png b/styles/Modify_logo_musta.png
new file mode 100644
index 0000000..ebd9ab7
Binary files /dev/null and b/styles/Modify_logo_musta.png differ
diff --git a/styles/Modify_logo_valkoinen.png b/styles/Modify_logo_valkoinen.png
new file mode 100644
index 0000000..54d5fa9
Binary files /dev/null and b/styles/Modify_logo_valkoinen.png differ
diff --git a/styles/style.css b/styles/style.css
new file mode 100644
index 0000000..5ba8414
--- /dev/null
+++ b/styles/style.css
@@ -0,0 +1,67 @@
+body{
+    margin: 0px;
+    background-color: rgb(235, 235, 235);
+}
+
+.headerDiv{
+ height:50px; 
+ background-color:gray; 
+ padding:0px;
+  margin:0px;
+}
+
+.kuvatHeaderDiv{
+    display: flex;
+    justify-content: end;
+    align-items: center;
+}
+
+.kuvatHeaderDiv input{
+    margin: 10px;
+}
+
+.imagesDiv{
+    margin: 10px;
+    display: inline-flex;
+   
+    flex-direction: column;
+    justify-content: center;
+    align-items: center;
+}
+
+.active{
+    background-color: gray !important;
+}
+
+.imagesDiv img{
+   
+}
+
+.kirjauduDiv{
+    height: 100vh;
+    display: flex;
+    justify-content: center;
+     align-items: center;
+   
+}
+
+.kirjauduForm{
+    display: flex;
+   flex-direction: column;
+}
+
+.kirjauduForm label{
+    font-size: 20px;
+}
+
+.kirjauduForm input{
+    margin-bottom:15px;
+    padding: 10px;
+    border-radius: 5px;
+    border:1px solid black;
+}
+
+.kirjauduForm .btn:hover{
+background-color:gray;
+}
+