<?php

namespace App\Helpers;

use Illuminate\Support\Facades\DB;
use App\Http\Requests;
use Illuminate\Support\Facades\Auth;
use PHPShopify;
use App\StoreCronJob;
use App\CronJob;
use App\StoreQueueJob;
use App\StoreLog;
use App\Logs;
use App\Plan;
use App\User;
use Illuminate\Support\Facades\Hash;
use Artisan;
use App\ShopifyStore;
use App\ShopifyAppCharge;
use Illuminate\Support\Facades\Config;
use ClouSale;
use Illuminate\Support\Facades\Log;
require_once("includes/sendgrid/sendgridphp.php");
// use includes\sendgrid\sendgridphp;

class mail2user{

	public static $shopifyStore;

	public function __construct(){
  	}


//  public static  function getDisplayDateTimeStringjdjfjd(){
//     return 'hiteshmalishhaksgjkajg';
// }


public static function sendKeysMail($ownername, $to, $user_id ,$shopurl ,$logintoken){
		
		$subject = "Re: Welcome to Shopify to eBay Importer";
		$body =  '<p>Dear '.$ownername.'</p>
		         <p>Thank you for installing our app, You have successfully installed our Shopify to eBay app.</p>
                <p>Here is a helpful video guide on how to publish your first product on eBay:<a href="https://player.vimeo.com/video/942204338?badge=0&amp;autopause=0&amp;player_id=0&amp;app_id=58479" target="_blank">Click here</a></p>
                <p>We have provided 10 free listings for you.If you want to publish more products and want to explore more features please buy </p>
              <p>We have created a profile for you, which you can access by clicking on the profiles button in the left navigation bar. However, we strongly recommend creating your own profile by clicking on the "Add Profile" button in the upper right corner.</p>
                <p>When creating your profile, please ensure to enter accurate information regarding eBay category, postal code, location, etc. Incorrect eBay category selection can lead to a ban on your eBay account.</p>
                <p>Another vital aspect to consider is business policies. Business policies are mandatory for publishing products on eBay. If you already have business policies, you can select them from the dropdown menu named "Return," "Payment," and "Shipping Policy." If you do not have existing business policies, you can create shipping and return policies directly from the profile page.</p>
                <p>However, we highly recommend creating your own business policies on eBay. You can find guidance on how to create business policies on eBay by following this link:<a href="https://www.ebay.com/help/policies/business-policy/business-policies?id=4212" target="_blank">Click here</a></p>
                <p>Additionally, you can book a FREE setup call using the  <a href = "https://calendly.com/pankajnarang81/shopify-to-ebay-integration-session">.link </a></p>
                <p>Best Regards,<br />Rohit Khariwal<br />Manager - Shopify Applications </p>';
				
		$email = new \SendGrid\Mail\Mail(); 
        $email->setFrom("shopifyapps@infoshore.biz", "Rohit from InfoshoreApps");
        $email->setSubject($subject);
        $email->addTo($to);
        $email->addBcc("pankajnarang81@gmail.com");
        $email->addContent(
			 "text/html", $body
               );
		$sendgrid = new \SendGrid('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');
        try {
			$response = $sendgrid->send($email);
			echo "email sent";
            return true;
		} catch (Exception $e) {
            return false;
        }		
	}

}
