Rabu, 09 November 2011

Sending emails with PHP, ranging from regular email, HTML email to the email with attachments


Sending emails with PHP is not a difficult thing, PHP has provided the function mail () to send email with PHP. You can send plain text emails, HTML emails even emails with attachments easily.
Function mail ()
First we learn first the function mail (). The syntax is like this:
mail (string to, string subject, string message [, string additional_headers [, string additional_parameters]])
Function mail () has 3 mandatory parameters and one optional parameter. To the third parameter is the destination email, subject line and email content, as well as an optional parameter that is an email header.
You need to change php.ini settings on the SMTP to the mail function () can work on your computer. If you are using Unix / Linux then the function mail () using Sendmail on Linux, while the Windows function mail () will use a remote SMTP mail server to send mail. My advice if you want to try the function mail (), try on your hosting. All our hosting that supports PHP can perform the function mail () without any problems.
Okay rather than confused, we just practice to make the mail function () is simple:
<?

mail ("admin@websitesaya.com", "Welcome", "Hello admin \ n Thank you \ n for your response");

?>
If you try the example above then PHP will send an email to admin@websitesaya.com with the title "Welcome" and the contents of his email like this:

Hello admin
Thank you
for your response
How can I create a new line in the email content? course by using the \ n (New Line) we can put content into the email. If you try the code on your computer (localhost) and you have not done the SMTP settings, it will display an error message PHP. If we want a more humane error message if email is successfully sent or failed, you can use if as in the following example:
<?

if (mail ("admin@websitesaya.com", "Welcome", "Hello admin \ n Thank you \ n for your response")) {

echo "Email has been sent";

Else {}

echo "Email failed messages";

}

?>
With the code, if for some reason fails emails sent, it will display a message that the email failed messages. Now we try a more complex code.
<?

if (mail ("admin@websitesaya.com", "Welcome", "Hello this is content of email",, "From: Dhimas <tes@dhimasronggobramantyo.com>")) {

echo "Email has been sent";

Else {}

echo "Email failed messages";

}

?>
By using code like that, then the recipient will receive information that the sender is Dhimas with tes@dhimasronggobramantyo.com email address. Easy right? Now we learn that even more difficult.
HTML email
To send emails in HTML is also not difficult. We just need to notify the email destination that email that we send HTML forms. How do I? course by adding a header to indicate that our email HTML email. Okay instead of just trying to confuse the following php code:
<? Php

mail ('admin@websitesaya.com', 'Email Subject',

'<html> <body> <p> <i> Hello world </ i>, this HTML emails you know. </ P> </ body> </ html>',

"To: The Receiver <admin@websitesaya.com> \ n".

"From: The Sender <adadeh@gmail.com> \ n".

"MIME-Version: 1.0 \ n".

"Content-type: text / html; charset = iso-8859-1");
Header that we use to send HTML email is:
"MIME-Version: 1.0 \ n".
"Content-type: text / html; charset = iso-8859-1");
With a header like that, then that email will be read as an HTML file and of course for our email we can insert HTML code into any HTML emails.
Remember, if the email client / destination does not support HTML, the email is not opened. But most current email address already supports HTML. Remember, most, means there is not support HTML.
Email with Attachment
Now you may ask? can not send emails with attachments? The answer could be? So how? of course by changing its header. First of all we do we need a form to upload a file, and we then take the uploaded file variable (see articles on uploading files with php).
All email using base64 encoding for attachments mengencoding either in the form of a binary file or text file.
Because we need mengencoding our attachment to Base64 encoding, then we need a PHP function base64_encode (). Once encoded, we put our results into the header and send the email.
Okay, rather than just trying to confuse us directly. We will create two files, the first is form.html sending an email that contains a form. And the second is mail.php which contains a function to send us an email. Immediately, we make form.html and fill it with the following code:
<html>

<head>

<title> Send e-mail with attachments </ title>

</ Head>

<body>

<h1> Send Email with Attachment </ h1>

<form method="POST" action="mail.php" enctype="multipart/form-data">

<p> To: <input type="text" name="to" value="" /> <br />

From: <input type="text" name="from" value="" /> <br />

Title: <input type="text" name="subject" value="" /> </ p>

<p> Message: <br />

<textarea cols="70" rows="20" name="message"> </ textarea> </ p>

<p> File: <input type="file" name="fileatt" /> </ p>

<p> <input type="submit" value="Kirim" /> </ p>

</ Form>

</ Body>

</ Html>
Okay, you would have understood the code, because the code is just a normal HTML code. Whereby when the send button is clicked, then we call the mail.php file. Now create mail.php and fill it with the following code:
<html>

<head>

<title> Sending Email with Attachment </ title>

</ Head>

<body>

<?

$ To = $ _POST ['to'];

$ From = $ _POST ['from'];

$ Subject = $ _POST ['subject'];

$ Message = $ _POST ['message'];



$ Fileatt = $ _FILES ['fileatt'] ['tmp_name'];

$ Fileatt_type = $ _FILES ['fileatt'] ['type'];

$ Fileatt_name = $ _FILES ['fileatt'] ['name'];



$ Headers = "From: $ from";



if (is_uploaded_file ($ fileatt)) {

$ File = fopen ($ fileatt, 'rb');

$ Data = fread ($ file, filesize ($ fileatt));

fclose ($ file);

$ Semi_rand = md5 (time ());

$ Mime_boundary = "== Multipart_Boundary_x semi_rand} {$ x";

$ Headers .= "\ nMIME-Version: 1.0 \ n".

"Content-Type: multipart / mixed; \ n".

"Boundary = \" {$ mime_boundary} \ "";

$ Message = "Email with attachments and MIME format. \ N \ n".

"--{$ Mime_boundary} \ n ".

"Content-Type: text / plain; charset = \" iso-8859-1 \ "\ n".

"Content-Transfer-Encoding: 7bit \ n \ n".

$ Message. "\ N \ n";

$ Data = chunk_split (base64_encode ($ data));



$ Message .= "--{$ mime_boundary} \ n ".

"Content-Type: {$ fileatt_type}; \ n".

"Name = \" {$ fileatt_name} \ "\ n".

"Content-Transfer-Encoding: base64 \ n \ n".

$ Data. "\ N \ n".

"--{$ Mime_boundary} - \ n ";

}



$ Ok = @ mail ($ to, $ subject, $ message, $ headers);

if ($ ok) {

echo "Email has been sent <p> </ p>";

Else {}

echo "Email failed <p> sent! </ p>";

}

?>

</ Body>

</ Html>
If you have, run form.html, fill out forms that are available. Do not forget to retrieve files from your computer, then send the email. Easy right? we need to remember our mengencoding file attachments with base64 encoding. Good luck ...

Selasa, 08 November 2011

10 widgets to enhance your blog

Blog is like a woman. The more beautiful the woman, the more demand. So also with the blog. The more beautiful appearance, the more visitors feel at home in her blog. Indeed necessary in order to beautify blog blog looks neat.That way, visitors who stopped nor will feel at home and frequently visit our blog again. Many ways to enhance your blog, such as choosing the right templates and color. Widgetpun also needed to make our blog look more beautiful. Well, here are 10 options to enhance your blog widgets. 
1. Search BoxThis widget is very useful to facilitate visitors find the content of your blog. This widget provided by blogger. If you are in the top right sidebar of this blog is google adsense search box (overtly) hehehe. 
2. Alexa widgetAlexa widget is to notify the status of alexa rank blog. His choice of widgets if not wrong there are 3 kinds. This widget can be obtained from its own alexa site. 
3. Page Rank WidgetIt serves to determine the page rank blog. This widget can be obtained from pagerankchecker.info, mypagerank.net, and other sites. Many really are providing these widgets. 
4. Feedburner CountThis widget is to determine the number of buddies who subscribe to our blog. An example is in the right sidebar of this blog. This widget can be obtained from feedburner.com. 
5. Web / Blog CounterThis widget is to count the number of visitors to our blog. There are so many providers of web widgets / blog counter. Please look for yourself on google. But, one of the most famous is histats.com. 
6. Flag CounterFlag counter has the same function as the counter blog. But the difference, this counter also displays the flag of the country where the visitor comes to the flag symbol. For example, can be seen at the bottom of this blog. Just click the widget if it wanted. Do not worry, this is not advertising. You see, I forgot the address (hehe). 
7. Mybloglog Recent ReadersWidget of this show mybloglog avatars of the visitors your blog. This widget is quite popular but I do not install this widget because it takes place (space) and add weight loading the blog page blog. 
8. Shoutbox / Guestbox / GuestbookThis widget like the comment box. This is more easily used to make lasting friendships fellow bloggers because this widget is usually used when stopping to say hello on the blog. Much of this guestbook widget providers like shoutmix, oggix, etc.. 
9. Recent PostThis widget function to display the latest articles. For example, there are in the left sidebar of this blog. To get the widget it, try searching on search engines aja yah yes. Many really are nyediain. 
10. Recent CommentThis widget is very useful even more useful than recent post. Why? This widget displays the most recent comments function on our blog. So, we can know if there is incoming comments. Memangsih widget is not very useful if your blog only has a few posts. But, if the blog has hundreds of posts, how do we know the comments that go? So, I strongly recommend this widget. Find this widget wrote on search engines (search engines). If not, bloggers have also already nyediain this widget. For recent post as well.

Minggu, 06 November 2011

how to disable autoplay on the flash and cd in windows 7

Usually when we plug the flash to the computer, or we enter into cdroom cd, then the autoplay window will appear that asks us to open the file or drive automatically. Of course this could be a loophole for the entry of virus into the computer when the flash or cd which had been infected with a virus inserted. This will be very detrimental to us as computer users / owners of computers. Would that every plugged flash or cd inserted into cdroom we scanned first with antivirus updates. There is no compromise with the virus, Do not let the virus get into our computer. Better to prevent than cure.


To disable autoplay in Windows 7, the following steps:
Go to the group policy editor by clicking [start]> [run]> type "gpedit.msc"> [Enter]

In the computer configuration, select the "administrative templates"> [all settings].
In the right pane, scroll down and locate the "turn off autoplay".


Once found, double click on turn off autoplay. In the window that appears click the radio button on the [Enable]. And on options, turn off autoplay on: select "all drives"


Click [Apply] and [OK].
Do the same on the user configuration. (Numbers 2-5)

10 Keys Discover the True Self

The rush of modern life, which moves fast paced, often makes us forget ourselves and lose control. There are many ways you can do to bring us back to the true self. Here are 10 power that can lead us back to ourselves and find a peace.1. AttendLive for today. The past has passed. You will never be able to go back and repeat those times again, you also will not be able to revive what is past. This life is what you are living now, no matter what has happened. It's all real and perfect. Do not look back or think too much about what will happen in the future. Our mind is always creating a variety of conversations that develop a sense of fear and make us try to save themselves. Tell your mind is busytalk was: 'Thank you for willing to share' and make sure 'I'm here, I'm there for you.' Every day, we all must always make choices and you are most know how to make the day that you live so lovely.2. United with natureSit on the grass or under a tree. Feel the earth's rotation, celestial majesty highway, the cold air hit your face, or the warmth of the morning sun. Smile for the vast sky, say hello to the flying bees and all the animals that you encounter. Take a stroll in the park or climbing hills. Proximity to nature can bring awareness of how your part of the vast universe of this.3. BerolahrgaExercise regularly to give pause to your thoughts that kept raging, help accelerate blood circulation, cleanse toxins from the body, and gives you energy as well as many other advantages. Choose activities that give you pleasure and make a blend. Do a healthy walk in one day and the practice of Yoga in the next day. Follow erobic exercise and meet new people. An extensive list of activities to choose from.4. SpiritualRecognize and realize you are an important personal and unique. Meditate, or sit quietly in silence, and enjoy the moment. Read religious books or guides that carry a positive message of personality and makes you feel strong. Do not forget to be grateful for your own health, home, people who love and your loved ones, friends who surround you, as well as happiness and joy that surround your life.5. ForgiveIt's time to let go. Forgive all parts of yourself, for all the flaws and imperfections. Forgive yourself for all the mistakes you've ever made in the past, forgive your childhood fears, emotions and anger forgive your adolescence, early adulthood sorry you are not willing to take risks. Forgive mistakes of your parents, siblings, relatives and people in the past. Remove all the steam. Forgiveness brings peace in the soul.6. Have a good timeGive yourself the chance to relax and pamper yourself. Read a fun book. Remove one-time money to buy the things you want most. Do a pleasure just to yourself.7. NutritionListen to your body's needs. Fill your body's need for nutritious food. Consumption of vitamins are beneficial for the body. With a healthy and fit body makes you always appreciate life.8. Remove AssessmentStop judging and blaming. Do not cast criticism on others or themselves. Say the words of encouragement to yourself and everyone you meet. Accept others as they are, complete with all the differences they have.9. Help OthersContact and reached out to friends in need. Offer help to others unconditionally. Be a good listener and really listen to what other people say. Find ways to help others lift the burden of life by listening to their complaints.10. LoveLove yourself and use positive words to give encouragement. Praise others with sincerity and make them smile. Speak with love and sincerity from the bottom of my heart.The ten key strengths mentioned above is not a difficult thing to do anyone. Keep your pace for a moment of your life fast-paced, and take the time to do these ten things. Undoubtedly you will discover the beauty of life as well as the completeness of your true self.

8 Human Intelligence

Humans have intelligence that can be differentiated into a more popular term 8.Dalam, eighth intelligence possessed by humans it is:1.Kecerdasan Linguistics: Word SmartIntelligence is to use words in efektif.Kecerdasan is very useful for writers, actors, comedians, celebrities, radio and great speakers. Kecerdasa njuga help successful career in marketing and politics.Try to check the personality below, which one is your personality:- Like creative writing at home.- Nice to write fictional stories, jokes and stories.- Enjoy reading a book in my spare time.- Enjoys rhymes, poems and word games.- Like do crossword puzzles or playing scrable.Which of your linguistic abilities?If you're in school, college talkative and less attention to the lessons or enjoy writing poetry at home but do not do homework, happy bercerita.Kamu mepunyai intelligence linguistik.Kembangkanlah terus.Suatu your potential as you will be a great person.

2. Logical-Mathematical Intelligence: Number SmartThis one is intelligence skills and proficiency to process numbers using logic and reason sehat.Ini is the intelligence that scientists use to make hypothesis and test it with eksperimen.Ini diligently intelligence is also used by tax accountants, computer programming and mathematicians.Try checking your skills are at the moment:- Calculating the arithmetic problems quickly by rote.- Enjoy using the language of computer or software program logic- Expert bermaincatur, and other strategy games- Explain the problem secaralogis-Designing Experiments-Like-tekilogika bermainteka- Easy-effect memahamisebab- Enjoy math and science as well as get a good achievementWhich logical abilities that I have??This intelligence is associated with intelligence in bersekolah.Jika you have nerdy tendencies, IPA received high marks, enjoy and interact with the computer, trying to find answers to the difficult, then you talented big in intelligence ini.Kembangkan continues, someday you will become a scientists, accountants, engineers, computer programming or maybe philosophy.3. Spatial intelligence: Smart PictureIt is the intelligence picture and it involves kemampua nuntuk bervisualisasi.Kecerdasan visualize images inside someone's head or create it in the form of 2 or 3 dimensi.Seniman or sculptors and painters have this in high-level intelligence.Please check the skills you think you are in yourself:- Stand out in art class class.- Easy to read maps, charts and diagrams.- Menggamba rsosok people or things exactly the original- Doodling on paper- It is easier to understand through pictures than in words while reading.So which one spatial abilities do you have??Seandaianya you stand out in this intelligence, kembangkanlah.Karena a bias when you become a painter, sculptor, designer, and designers get up.4 Bodily-Kinesthetic Intelligence: Body SmartPhysical intelligence is the intelligence of the whole body (athletes, dancers, artists, pantomimaktor) and also the intelligence of the hand (mechanics, tailors, carpenters, surgeons)Try your existing skills piilih yourself:- Move-motion when sitting- Engage in physical activities such as swimming, biking, hiking or skate board.- Need to touch something you want to learn.- Enjoy jumping, wrestling and running.- Shows sepertikayu kerampilan in handicrafts, sewing, carving.- Enjoy working with clay, finger painting, or the "dirty" other.- Like to disassemble an object again later nmenyusunnyaThen the bodily kinesthetic abilities what you have now??If you do not like sitting for long and prefer to move, like field studies, then you stand out in ini.Maka intelligence continues to develop.5. Musical intelligence: Music SmartMusical intelligence involves the ability to sing a song, remember the melody of music, has a sensitivity musik.Dalam rhythm or just enjoy a more sophisticated form, this intelligence include divas and piano virtuoso in the world of art and culture.Baka tmusik talent is something that diving is allowed or abandoned in sekolah.Jikalau you have this talent so it's good to develop outside the school environment.6. Inter Personal Intelligence: Smart PeopleKecedasan involves the ability to understand and bekerj for others. This intelligence involves a lot of things, ranging from the ability to empathize, the ability to lead, and the ability to organize others.Well if you are very popular among your friends and able to adapt to the environment with your cepat.Maka ini.Kembangkanlah gifted in intelligence, someday you will become a leader, counselor, employer or community organizer.7. Intra Personal Intelligence: Self SmartThis intelligence involves the ability to understand ourselves, intelligence determines the actual content of what we are sendiri.Kecerdasan is very important for entrepreneurs wandan other individuals who should have the requirement of self-discipline, confidence, and self-knowledge to know the area or new business.If you are able to know who you are in fact, clever targeting and determine targets for self-confidence and tidakpemalu sendiri.Kamu, then you are gifted in intelligence ini.Kembangkanlah continue this intelligence because it is so necessary for success in life.8. Naturalist intelligence: Nature SmartNaturalist intelligence involves the ability to recognize the forms of nature around us: Flowers, birds, trees, animals and other flora and fauna. This intelligence is needed in many professions such as biologists, penjag ahutan, doctors, animal and holtikulturalis.We must remember that every person has 8 intelligence above and every day use and dikombinasikannya.Contohnya only when dribbling a soccer player then they use the bodily-kinesthetic intelligence untu kmenggiring ball, spatial intelligence to visualize the position of the ball after the opponent's kick, and interpersonal intelligence for collaboration with other team members. But they have one of the most dominant intelligence is kinestik-physical.Well sekalilagiuntukmenjadi the most dominant suksesandaharusbisamencaridanmenemukankecerdasan padadiri you and continue to hone that talent and become a successful and great people.