Hossam Elshahawi

Hossam Elshahawi

Software Engineer ❤️ Web

Setting up Exim at cPanel & WHM with MailJet

This guide will help you to use Mailjet SMTP service as Outgoing SMTP Server in cPanel & WHM with Exim.

Mailjet is a transactional email service. It comes stock with a powerful API for fast implementation into applications for sending email reliably over SMTP, but it can also be used as a smart host for all of your server’s outgoing email.

I’m running a CentOs 7 instance running cPanel on GCP ( Google Cloud Platform) and this tutorial is just a workaround for sending email into inbox safely , because GCP block port 25 which is responsible for sending outgoing emails to another mailboxes

Step 1

The below instructions cover how to do this via WHM, simply go to WHM -> Exim Configuration Manager -> Advanced Editor and alter the sections indicated.

Step 2

Click on Advanced Editor.

Step 3

Scroll down and go to Section: AUTH and add below lines of code:

driver = plaintext
public_name = LOGIN
client_send = : USERNAME : PASSWORD

and sure replace Username and Password with Mailjet credentials as you can find it in your account here if you didn’t have an account you can simply signup for free and you will see the credentials in your dashboard like this.

Step 4

Go to Section: ROUTERSTART and add below lines of code:

driver = manualroute
domains = ! +local_domains
transport = mailjet_smtp
route_list = * in-v3.mailjet.com

Step 5

Go to Section: TRANSPORTSTART and add below lines of code:

driver = smtp
port = 587
hosts = in-v3.mailjet.com
hosts_require_auth = in-v3.mailjet.com

Step 6

Click the Save button. This will restart exim. If exim does not restart, then restart it manually from Restart Services > Mail Server (EXIM).

Step 7

Mailjet requires to add the domain which have the ability to send to a list therefore you have to login into Mailjet account and go to Configuration >> Manage sender domains and addresses  you can visit the link here

as you can see there I have added a one domain and I can add more , when you add a new one they will require a verification of domain ownership with uploading a txt file with a given name or with provided DNS record an both works fine.

All done. In conclusion, Your outgoing email on your server are goes through Mailjet. 🙂

Manually upgrading phpMyAdmin in Sentora

I’m going to upgrade phpMyAdmin to latest version ( 4.8.5 ) in a CentOs 7 server running a Sentora control panel as I upgraded its php version to 7.2 ,therefore some issues appeared in phpMyAdmin like you can’t make a database export to file and it throws a 500 internal server error , simply in the following steps we are going to make a safe upgrade.

Step 1 : Sentora app directory

We have to go to the app directory where we can find the phpMyAdmin

cd /etc/sentora/panel/etc/apps

Step 2 : Download latest phpMyAdmin version

wget https://files.phpmyadmin.net/phpMyAdmin/4.8.5/phpMyAdmin-4.8.5-all-languages.zip

also you can check the latest version there : https://www.phpmyadmin.net/downloads/

Step 3 : Unzip the file

unzip -q phpMyAdmin-4.8.5-all-languages.zip

Step 4 : Take the configuration to safe place

we can copy config.inc.php file which holds the all configuration to safe place like /home

cp /etc/sentora/panel/etc/apps/phpmyadmin/config.inc.php /home/

Step 4 : Rename Old phpMyadmin folder and the newest one

mv phpmyadmin phpmyadmin_old

mv phpMyAdmin-4.8.5-all-languages phpmyadmin

Step 5 : Set the configuration

cp /home/config.inc.php /etc/sentora/panel/etc/apps/phpmyadmin/

Step 6 : Delete old version

cd /etc/sentora/panel/etc/apps/

rm -rf phpmyadmin_old

All done. In conclusion, You have the latest phpMyAdmin running on your server 🙂

Launchers and Choosers at Windows Phone 8

Today , I’m going to  discuss how to use Launchers and Choosers in a Windows Phone 8 application which allows your App to interact with Native WP8 Applications .

What are Launchers ?

We can simply say the Launchers  used to run/perform a task beside your App  , They are APIs* that allow Apps to do common tasks such as making a phone call, sending an SMS or browsing the web , We will cover the Launchers which is available for you as a developer in your Dev. Platform with a list of the sorts and how we can use it in our App .

* application programming interface (API)

Here you are a list of Launchers which is available in WP Dev. Platform :

list of launchers

list of launchers

Here you are list of launchers with its refrence from MSDN :

  • EmailComposeTask  launches the Email application which displays a new email message.
  • MarketplaceDetailTask  launches the Windows Phone Marketplace client application which then shows the details page for a product specified by the unique identifier you provide.
  • MarketplaceHubTask  launches the Windows Phone Marketplace client application.
  • MarketplaceDetailTask  launches the Windows Phone Marketplace client application which then displays the review page for your application.
  • MarketplaceSearchTask  launches the Windows Phone Marketplace client application which then shows the search results based on search terms you provide.
  • MediaPlayerLauncher  launches the Media Player application and plays the media file you specify.
  • PhoneCallTask  launches the Phone application and displays the specified phone number and display name. The phone call is not placed until it is initiated by the user.
  • SearchTask  launches the Search application and performs search query you provide.
  • SmsComposeTask  launches the Messaging application which displays a new SMS message.
  • WebBrowserTask  launches the Web browser and displays the URL you provide.

Important Thing !

To have your Launcher works , we need to take a reference from Microsoft.Phone.Taskes , so  you have to put this statement in the top of your code file .

using Microsoft.Phone.Tasks;

Using a Launcher

Let’s see a couple of examples for using launchers , I will make a Launcher which make SMS , remember every launcher have their own set of properties and you can dive into it from the msdn reference which i have mentioned above after setting any of them you have to show them by .show()

Our Example :

SmsComposeTask SStoP = new SmsComposeTask(); // we take an object from SmsComposeTask
SStoP.To = "010032554860"; // Phone number to send him/her the message
SStoP.Body = "Test SMS for this post."; // Our Message

What are Choosers ?

Choosers are APIs similar to launchers; however they return a value to the calling application. They are enabling common tasks such as taking a photo or selecting a phone number from the contacts list.

What's Choosers ?

What’s Choosers ?

Here you are list of Choosers with its refrence from MSDN :

List of choosers

List of choosers

Using a Chooser

the choosers is slimier to the launcher , they has its own properties , after setting up its properties which you can have from the msdn reference for more info, you need to .Show() them to the user.  To do this, you simply call the Show() method on your Chooser.

Important Thing You have to KNOW !

the most important thing for the choosers and the thing which is a difference between launchers and choosers is you have to make an event handler when you are using an chooser  for when they make their selection , because will not able to get the values of chooser you set without it , as our example in taking a photo from Phone camera which i showed above in the Figure , which choosers you App gets value of images from the Camera App then have to store it in the App Storage to make the effects on , so we can grab the values they choose .

As an example :

CameraCaptureTask CamTask1 = new CameraCaptureTask();
CamTask1.Completed += new EventHandler<PhotoResult>(CamTask1_Completed);

event handler code:
void CamTask1_Completed(object sender, PhotoResult e)
BitmapImage bmp = new BitmapImage();
image1.Source = bmp;

I recommend to use a hardware device for testing App which is using a Chooser because you will have some features disabled in the emulator like make a phone call , sending SMS or capture a Photo from the webcam :) 
for any thing not clear just leave your comment with your question and I will give you a help .