php (35) javascript (31) phpjavascript (30) jquery (23) html (20) mysql (14) database (9) codeigniter (4) json (4) bar chart (2) calendar (2) column chart (2) framework (2) google maps (2) query (2) tables (2) url (2) dropdown (1)

Friday, January 19, 2018

How to Send SMS and Email Using PHP?

To send sms we need an API from the sms service provider. 
Here we are providing some of the sms service providers list.
Text Local:
<?php $authKey = "XXXXX"; //Your Authentkation key $mobileNumber = "9999999"; //Sender ID,While using route4 sender id should be 6 characters long. $senderId = "AAABBB"; $mymsg = "Hello world"; //Your message to send, Add URL encoding here. $message = urlencode("$mymsg"); $route = "default"; $postData = array( 'authkey' => $authKey, 'mobiles' => $mobileNumber, 'message' => $message, 'sender' => $senderId, 'route' => $route ); //API URL provided by your SMS service provider $url = ""; $ch = curl_init(); curl_setopt_array($ch, array( CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_POST => true, CURLOPT_POSTFIELDS => $postData )); //Ignore SSL certificate verification curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $output = curl_exec($ch); if (curl_errno($ch)) { echo 'error:' . curl_error($ch); } curl_close($ch); echo $output; ?>
mail() is a predefined function in php and this is the simplest way
to send mail using php.
$msg = "Hello World";

// use wordwrap() if lines are longer than 70 characters
$msg = wordwrap($msg,70);

// send email
mail("","My subject",$msg);


  1. Hello there! I know this is kind of off topic but I was wondering which blog platform are you using for this site? I'm getting sick and tired of Wordpress because I've had problems with hackers and I'm looking at alternatives for another platform. I would be great if you could point me in the direction of a good platform.Singapore

  2. Thanks for provide Valuable and helpful advice. Digital Signature Certificate

  3. Thanks For Sharing This, Very Interesting And Helpful Support Provide By this blog. Digital Signature Certificate

  4. Thanks for sharing, nice article!. Thank you
    Với những dịch vụ như: vận chuyển hàng hóa bằng container, vận chuyển ô tô Bắc Nam, vận chuyển xe máy Bắc Nam, cho thuê xe tải chở hàng,... đảm bảo phục vụ quý khách hàng một cách tốt nhất với chất lượng cao, uy tín, giá rẻ.

  5. 2 - Moving furniture company in Riyadh clarifies that attention to the packaging of furniture well and dismantling each piece and packaging material packaging whether it is plastic bubbles or cardboard, is one of the important things that ensure the safety of furniture during the process of transition and protection from exposure to breakage or injury to any scratch or injury , As well as protection for furniture from exposure to dust in the road.
    شركة نقل عفش
    شركة نقل اثاث من الرياض الى جدة

    شركة نقل عفش من الرياض الى جدة
    شركة نقل عفش بمكة


More Posts