PHP Code to email your resume to all H-1B and PERM Employers

function sanitize_my_email($field) {
$field = filter_var($field, FILTER_SANITIZE_EMAIL);
if (filter_var($field, FILTER_VALIDATE_EMAIL)) {
//echo $field;
return true;
} else {
//echo $field;
return false;
}
}
include(‘db_include.php’);
$query = “SELECT DISTINCT EMPLOYER_POC_EMAIL FROM `2021H1BQ3` where emp_poc_email_sent = ” limit 1″;
//echo $query;
//echo ”
“;
$result = mysqli_query($dbcon, $query) or die(‘You Must Enter An Employer Name’);

while ($row = mysqli_fetch_assoc($result))
{
foreach($row as $key => $value)
{
if (strtoupper($row[‘EMPLOYER_POC_EMAIL’]) == ‘N/A’) {
//echo “Skipped: ” . $value . ” bad email address”;
//echo ”
“;
} else {
//echo “Email Sent To: ” . $value;
$to_email = $value;

$query_update = “UPDATE 2021H1BQ3 SET emp_poc_email_sent=’YES’ where EMPLOYER_POC_EMAIL='” . $value . “‘”;
if (mysqli_query($dbcon, $query_update)) {
// echo ” Record updated successfully”;
} else {
//echo ” Error updating record: ” . mysqli_error($conn);
}

//echo ”
“;
}

}

}
mysqli_close($dbcon);

//$to_email = ‘vbierschwale@gmail.com’;
$subject = ‘A sample of my work can be found at GuestWorkerVisas.com’;
$message = ”

I develop database systems.

No job is too big or too small.

To see what data we have on your company, you can enter your company name in the Employer Name and / or Secondary Employer on this page.

https://guestworkervisas.com/CurrentData.php

For those wanting to expand their business, you might be interested in our contact list of 71,086 unique company contacts.

This list was compiled from all H-1B applications for 2021 and can be found on our store.

We also have a list of 34,198 unique immigration attorney contacts available.

Similar products are available on the open market for much more, but these are H-1B specific which is why I believe they may be useful to your business.

Respectfully,

Virgil Bierschwale

GuestWorkerVisas.com

“;

// Always set content-type when sending HTML email
$headers = “MIME-Version: 1.0” . “\r\n”;
$headers .= “Content-type:text/html;charset=UTF-8” . “\r\n”;

// More headers
$headers .= ‘From: <virgil@guestworkervisas.com>’ . “\r\n”;
$headers .= ‘Bcc: virgil@guestworkervisas.com’ . “\r\n”;
//check if the email address is invalid $secure_check
$secure_check = sanitize_my_email($to_email);
if ($secure_check == false) {
//echo “test
“;
echo $to_email;
echo “Invalid input”;
} else { //send email
mail($to_email, $subject, $message, $headers);
//echo “This email is sent using PHP Mail”;
}
?>


Untitled

The link above is to a csv file that has 56,755 distinct email addresses taken from the perm data file.

The following code is the connection string that you will need to adopt to your system.

<?php
DEFINE (‘DB_USER’, ‘guestworkervisas_vjb’);
DEFINE (‘DB_PSWD’, ”);
DEFINE (‘DB_HOST’, ‘localhost’);
DEFINE (‘DB_NAME’, ‘guestworkervisas_datafiles’);
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$dbcon = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);
//$dbcon2 = mysqli_connect(DB_HOST, DB_USER, DB_PSWD, DB_NAME);
?>
When I built this, I called it via a cron job that would run every hour, so essentially it sent 24 emails a day to keep me under the spam radars.