Email sending requirements is very usual for most of the web applications. Also, PHP give us a very flexibility to send email, a simple mail() function is enough for sending email, where php uses its local server to send email.
But, often a big problem arise that, mails are sent to spam/junk instead of inbox and sometimes even don't reach.
The problem is the server that the email are sending from. Many servers/hosts are one another's black lists why they don't accept email in inbox from those sites. even, if you r sending from a valid host & using "From" attribute to a email domain that's not valid, even then this problem will arise.
The best way is to send emails using smtp servers. Also, sometimes attachments,ssl security, pop3 access to get emails etc are required.
To reduce the coding complexity, a small email library have been developed that is named & known as "phpmailer". You can download from Sourceforge.net web site along with library files & documentations. The documentations are very easy to understand & a lot of examples are also exist. You can also make a custom bulk email sending solution application using this library.
Here is an example code that uses phpmailer class gmail smtp service to send email. For this code to execute you need to have two class files, class.phpmailer.php & class.smtp.php:
include("class.phpmailer.php");
include("class.smtp.php");
$mail = new PHPMailer();
$body = $mail->getFile('templatefile.tpl');
$mail->IsSMTP();
$mail->SMTPAuth = true;
$mail->SMTPSecure = "ssl";
$mail->Host = "smtp.gmail.com";
$mail->Port = 465;
$mail->Username = "yourusername@gmail.com";
$mail->Password = "yourpassword";
$mail->AddReplyTo("yourusername@gmail.com","Name");
$mail->From = "name@yourdomain.com";
$mail->FromName = "First Last";
$mail->Subject = "PHPMailer Test Subject via gmail";
$mail->WordWrap = 50; // set word wrap
$mail->MsgHTML($body);
$mail->AddAddress("whoto@otherdomain.com", "Send to Name");
$mail->IsHTML(true);
if(!$mail->Send()) {
echo "Mailer Error: " . $mail->ErrorInfo;
} else {
echo "Message sent!";
}
Notice that, with the $mail->AddAddress() function, you can add many email adresses to send same email at once.
1
JQuery is a javascript-library that is very very useful & help us to do more with less code. It easier the use of DOM(Document Object Model) to work with various elements on document. Another most useful feature is that, it has cross browser compatibility, that is a big plus, we don't have to think, will a function will work on all browsers or not. We can simply use this and be confident about the compatibility with browser saving the time to test them on all browsers. If you don't have it yet, you can download it from JQuery Website. Always use uncompressed version rather than minified version.
There is an root factory function $(), that has a huge use. You can use it to select any element from the document with css selector notation. Like $('#idname') will select the element that has the id as 'idname'. Again, $('.classname') will select all elements that has associated with the class 'classname'. Like these, you can use most of the css notation that is w3 complaints. This helps us to select elements from document a lot.
You can change visual style of an element easily with jquery. Like, $('#idname').addClass('classname') , it will apply The styles of 'classname' to the element with id named 'idname'.
If you want to do something on body onload event, then you can do it easily with jquery library with simple code in your .js file like:
$(document).ready(functionName);
function functionName()
{
alert('Hellow World');
//do something
}
You can register event to a element event very easily like as follows:
$('#home').bind('click',LoadHome);
function LoadHome()
{
// do something
}
You can use ajax technology lot more easier with help of jquery without writing big code. Simply
$('#center').load('template.php');
This will load template.php in the element id named 'center' with a ajax request. If you want to do something when ajax request starts or stops, you can also do that by using following functions:
$('#center').ajaxStart(ShowLoading);
$('#center').ajaxStop(HideLoading);
function ShowLoading()
{
$('#center').addClass('loading');
}
function HideLoading()
{
$('#center').removeClass('loading');
}
now if that class has som definition of background animated images, that will be shown up at the start of ajax request & will be hidden when ajax stops/response arrived.
JQuery also helps lot on many more sections like:
* Pagination
* Image gallery
* banner rotator
* form validations etc.
There is an root factory function $(), that has a huge use. You can use it to select any element from the document with css selector notation. Like $('#idname') will select the element that has the id as 'idname'. Again, $('.classname') will select all elements that has associated with the class 'classname'. Like these, you can use most of the css notation that is w3 complaints. This helps us to select elements from document a lot.
You can change visual style of an element easily with jquery. Like, $('#idname').addClass('classname') , it will apply The styles of 'classname' to the element with id named 'idname'.
If you want to do something on body onload event, then you can do it easily with jquery library with simple code in your .js file like:
$(document).ready(functionName);
function functionName()
{
alert('Hellow World');
//do something
}
You can register event to a element event very easily like as follows:
$('#home').bind('click',LoadHome);
function LoadHome()
{
// do something
}
You can use ajax technology lot more easier with help of jquery without writing big code. Simply
$('#center').load('template.php');
This will load template.php in the element id named 'center' with a ajax request. If you want to do something when ajax request starts or stops, you can also do that by using following functions:
$('#center').ajaxStart(ShowLoading);
$('#center').ajaxStop(HideLoading);
function ShowLoading()
{
$('#center').addClass('loading');
}
function HideLoading()
{
$('#center').removeClass('loading');
}
now if that class has som definition of background animated images, that will be shown up at the start of ajax request & will be hidden when ajax stops/response arrived.
JQuery also helps lot on many more sections like:
* Pagination
* Image gallery
* banner rotator
* form validations etc.
I got another great site for this kind of free service. I needed to make an image transparent. I didn't have the .psd files also didn't have photoshop software installed. I started getting help on internet & amazingly found a site that is giving this servoce for absolutely free. You can also make your existing any image to transparent one from here:
http://stuff.mit.edu/tweb/map.html
You have to enter the image url first(You won't have option to upload, only url). Then , you will be asked to choose a color that you want to make transparent and you are done. They will provide you the resultant image.
I won't say that the quality of the resultant image is "excellent", but its fair enough to continue simple works in case of emergency.
http://stuff.mit.edu/tweb/map.html
You have to enter the image url first(You won't have option to upload, only url). Then , you will be asked to choose a color that you want to make transparent and you are done. They will provide you the resultant image.
I won't say that the quality of the resultant image is "excellent", but its fair enough to continue simple works in case of emergency.
I had face a simple problem. I got a file of .docx format & i actually need in .doc format as I don't have office 2007 installed right then. But the requirement was urgent. So, i tried to find some online help. I found a lot of software that converts, but all requires to buy, no free software. Then I found a blog where one suggest a site named http://www.zamzar.com, which provide this service for free.
I went & find it true. I didn't even had to sign up, just uploaded file, gave my email address & submitted & I got my file within 5-7 minutes(although they told it may take up to 24 hrs). This time can be also reduced by signing up with them. That actually doesn't matter to me as i got my file without doing that. If you are facing such kind of problem, then you may get help with this site. It supports a lot of formats to convert.
I went & find it true. I didn't even had to sign up, just uploaded file, gave my email address & submitted & I got my file within 5-7 minutes(although they told it may take up to 24 hrs). This time can be also reduced by signing up with them. That actually doesn't matter to me as i got my file without doing that. If you are facing such kind of problem, then you may get help with this site. It supports a lot of formats to convert.
Its quite easy to accomplish this task. One main point that you have to remember, to out put a specific kind of data , you must have to set header for that kind of data. For csv file, it will be like this:
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"testexport.csv\"");
?>
Now You have to simply echo the data you want to export:
<?php
echo "test data";
?>
Another point, that is important for csv data is 'delimeter'. As you will may want to see the data in ms xl, you should use standard delemeter. If you don't need to see it & you will need to import it to mysql database, then you can use your self-defined delimeter & set it on phpmyadmin. By default, standard delimeter to goto next column is "," symbol & standard delimeter to go to next row is "\n". So if you echo data like this:
<?php
echo "test1,test2 \n test3,test4\n";
?>
Then, you will see 2 rows & 2 columns on ms excel.
Another hint, if you have an array & want it to export as .csv, then use implode() function to insert "," or "\n" after all member elements of the array.
<?php
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"testexport.csv\"");
?>
Now You have to simply echo the data you want to export:
<?php
echo "test data";
?>
Another point, that is important for csv data is 'delimeter'. As you will may want to see the data in ms xl, you should use standard delemeter. If you don't need to see it & you will need to import it to mysql database, then you can use your self-defined delimeter & set it on phpmyadmin. By default, standard delimeter to goto next column is "," symbol & standard delimeter to go to next row is "\n". So if you echo data like this:
<?php
echo "test1,test2 \n test3,test4\n";
?>
Then, you will see 2 rows & 2 columns on ms excel.
Another hint, if you have an array & want it to export as .csv, then use implode() function to insert "," or "\n" after all member elements of the array.
Here I will try to make you familiar with some freelance websites, that are exist around the internet now a days, and sure good ones:
1. FREELANCER.COM: This is the best freelance site around the internet according to my opinion & experience. This is because of many reasons, members account management system, project posting, reliability to work & get payment, low rate, etc. I will always suggest you to work here if possible, although at first, its a little tough to manage a project at first as there is a good contest between providers. But there is a good scope also. The projects, that are posted for free, is only for the beginner providers, no experienced providers(with feedback) can bid on those, so you always have an equal opportunity as others to prove yourself in these projects.
2. ODesk: This is a site, which each very suitable for you, if you want to work at hourly rate. They have client application to record provider's work-log & keep screenshot for buyer, that will assure about provider's work during the specified time. For this reason, buyer's are also inspired here to hire provider hourly rate. This site also has other fixed priced work as well.
3. RentACoder: This is another popular freelance site, its main feature is that, once you win a project, you can be sure about your payment. Among other sites, this feature is also exist on oDesk, but for only hourly based job. But here, the bid amount is cutout from buyer at the time of assigning the project to you & are kept by the site. After completing the work, on buyer's assurance, you will be paid by the site.
4. ScriptLance: This is the only site, where you can bid a minimum $5 amount. for this reason, several small jobs are posted here very often. Also, there are big projects as well. What is the benefit is, you can have a easy start without much effort with a small project.
There are some many more also like elance,guru etc, but not all sites are suitable for individuals in according to costing and project scope. The above sites are suitable for individuals to accomplish small to medium size projects an less costly in terms of fees.
1. FREELANCER.COM: This is the best freelance site around the internet according to my opinion & experience. This is because of many reasons, members account management system, project posting, reliability to work & get payment, low rate, etc. I will always suggest you to work here if possible, although at first, its a little tough to manage a project at first as there is a good contest between providers. But there is a good scope also. The projects, that are posted for free, is only for the beginner providers, no experienced providers(with feedback) can bid on those, so you always have an equal opportunity as others to prove yourself in these projects.
2. ODesk: This is a site, which each very suitable for you, if you want to work at hourly rate. They have client application to record provider's work-log & keep screenshot for buyer, that will assure about provider's work during the specified time. For this reason, buyer's are also inspired here to hire provider hourly rate. This site also has other fixed priced work as well.
3. RentACoder: This is another popular freelance site, its main feature is that, once you win a project, you can be sure about your payment. Among other sites, this feature is also exist on oDesk, but for only hourly based job. But here, the bid amount is cutout from buyer at the time of assigning the project to you & are kept by the site. After completing the work, on buyer's assurance, you will be paid by the site.
4. ScriptLance: This is the only site, where you can bid a minimum $5 amount. for this reason, several small jobs are posted here very often. Also, there are big projects as well. What is the benefit is, you can have a easy start without much effort with a small project.
There are some many more also like elance,guru etc, but not all sites are suitable for individuals in according to costing and project scope. The above sites are suitable for individuals to accomplish small to medium size projects an less costly in terms of fees.
Subscribe to:
Posts (Atom)





