Skip to content

Instantly share code, notes, and snippets.

@mhamzas
Last active October 20, 2019 00:36
Show Gist options
  • Save mhamzas/d22d428db7e6e001f5fb74d0fa674f06 to your computer and use it in GitHub Desktop.
Save mhamzas/d22d428db7e6e001f5fb74d0fa674f06 to your computer and use it in GitHub Desktop.
Simple PHP Script to Test Email2Case
/*
Author : M Hamza Siddiqui
Description : Simple PHP Script to Test Email2Case, Both methods are provided.
Date : Aug 2015
*/
<html>
<head>
<title>Email2Case Generator
</title>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous">
</script>
<link href="https://fonts.googleapis.com/css?family=Open+Sans&display=swap" rel="stylesheet">
<style type="text/css">
*{
font-family: 'Open Sans', sans-serif;
}
</style>
</head>
<body>
<?php
//Email information
//$admin_email = "ra1420588117284@x-ro1wnxfu9kkimin588gc5sjhtdft0f7nobkw0r50t73gsglu.3b-dvosuao.cs50.case.sandbox.salesforce.com";
//$email = "[email protected]";
$admin_email = $_REQUEST['sfemail'];
$email = $_REQUEST['myemail'];
//$start = $_REQUEST['start'];
$limit = $_REQUEST['limit'];
$start = 1;
if ($admin_email && $email && $start && $limit) {
for ($i = $start; $i <= $limit; $i++) {
$subject = "SF Case Test " . $i;
$comment = "SF Case test body" . $i;
mail($admin_email, $subject, $comment, "From:" . $email);
}
} else { ?>
<div class="container">
<div class="jumbotron ">
<h1 class="display-4">Salesforce Email2Case Generator!
</h1>
<p class="lead">This simple tool will create cases on your Salesforce org. For more details, please visit :
<a href="https://www.mhamzas.com/blog/2019/10/20/simple-php-script-to-test-email2case/">Click Here
</a>
</p>
<hr class="my-4">
<div>
<h2>How to Use:
</h2>
</div>
<h3>Method 1 :
</h3>
<div>Please send GET parameters.
</div>
<div >
<br>
<b>Example:
</b>
https://sfemail2case.herokuapp.com/salesforce.php?limit=
<limitvalue>&sfemail=
<[email protected]>&myemail=
<[email protected]>
<br>
<br>
<b>limit :
</b> Number of Cases/Email
<br>
<b>sfemail :
</b> Salesforce generated email address or your Live production email
<br>
<b>myemail :
</b> Your email address (Need this for Case)*
<br>
<br>
<div>
<b>Example with Data
</b>
https://sfemail2case.herokuapp.com/salesforce.php?limit=100&sfemail=ra142058811765@x-ro1wnxfu9kkimin588gc5sjhtdft0f7nobkw0r50t73gsglu.3b-dvosuao.cs50.case.sandbox.salesforce.com&[email protected]
</div>
<h3 style="padding-top: 20px">Method 2:
</h3>
<div>Fill the following details
</div>
<form method="get">
<div class="form-group">
<input required class="form-control" type="text" name="sfemail" placeholder="ra1420588117284@x-ro1wnxfu9kkimin588gc5sjhtdft0f7nobkw0r50t73gsglu.3b-dvosuao.cs50.case.sandbox.salesforce.com" />
<Br>
<input required class="form-control" type="text" name="myemail" placeholder="[email protected]" />
<Br>
<input required class="form-control" type="text" name="limit" placeholder="Number of emails" />
<Br>
<input type="submit" class="btn btn-primary" name="submit" />
<Br>
</Br>
</form>
* No Data is being used for any kind of tracking.
</div>
</div>
</div>
<div style="text-align: center">By
<a href="https://www.mhamzas.com">M Hamza Siddiqui
</a>
</div>
<? } ?>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment