Send email from xampp localhost. Follow the easy steps Goto http://glob.com.au/sendmail/ , download latest sendmail package. Extract the zip file and copy the files into your \xampp\sendmail folder(Replace every file in the existing folder). Update the sendmail.ini file in sendmail folder with the following details, and make sure it is not commented(;). smtp_server=smtp.gmail.com smtp_port=25 error_logfile=error.log debug_logfile=debug.log auth_username=yourname@gmail.com auth_password=gmailpassword force_sender=yourname@gmail.com Here i have added gmail account for sending emails. Open xampp\php\php.ini file find sendmail_path and update its value to "\"C:\xampp\sendmail\sendmail.exe\" -t" . Now it will look like below sendmail_path = "\"C:\xampp\sendmail\sendmail.exe\" -t" Make sure it's not commented(;) Restart your apache server. Now you can send email from xampp localhost! enjoy :-)
Tinyurl provides us a short and simple service to convert long URL to small(tiny) URL. We can send email without link breakage. Here is the tinyurl api to get shorten url. You can use any of the method. Method 1: Use file_get_contents to fetch tinyurl. echo file_get_contents('http://tinyurl.com/api-create.php?url=http://www.websnippetz.com'); file_get_contents is not working? If your are able to access php.ini file set allow_url_fopen = On or you can use the below method. Method 2: Use cURL (runs faster than file_get_contents) to fetch tinyurl. function get_tiny_url($url) { $url = "http://tinyurl.com/api-create.php?url={$url}"; $ch = curl_init(); $timeout = 5; curl_setopt($ch,CURLOPT_URL,$url); curl_setopt($ch,CURLOPT_RETURNTRANSFER,1); curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout); $data = curl_exec($ch); curl_close($ch); return $data; } echo get_tiny_url('http://www.websnippetz.com');
Happy to write post after long time :) I had a scenario that there is are some fields in a table like `id`,`group`,`object_id`. `group` field(ENUM) has three groups named `user`, `deal`, `scene` and `object_id`(it will have the primary key for corresponding group). ie., If the row has group name of `user`, then `object_id` refers to `user_id` and if the row has group name of `deal`, then object id will refers to `deal_id`. What i want to achieve is i need to have a field called `name` in result so that if the current row group is user then username should be displayed in `name` field and if the row group is `deal` then the `name` field should have `deal_name`.
Comments
Post a Comment