using php to encode characters for mailto function


When We use mailto function then body message and title in Microsoft outlook contain some additional characters like “+” and others. For remove those special characters we have to encode them.We can Use the rawurlencode function to encode the characters like space and others that aren’t valid in URLs.

For eg:
$title_mail = $ref[0]->title;
$sub = mb_convert_encoding($title_mail, ‘UTF-8’, ‘UTF-8’);
$body = rawurlencode($message);
$mail_query = array(
‘subject’ => $sub,
‘body’ => $body,
);
$mail_query = str_replace(“+”, “%20”, http_build_query($mail_query));

<a href=”mailto:?<?php echo $mail_query; ?>”>Mail</a>

Advertisements

19 responses to “using php to encode characters for mailto function

    • Hi Good afternoon,
      you can subscribe this blog . When you will come on the site there will be a Follow link image in bottom of site click on that. and then provide your email address. after that you can get every post from email.

      Thank you,

  1. Hrmm that was weird, my comment got eaten. Anyway I wanted to say that it is nice to know that an individual else also mentioned this as I had trouble locating the exact same info elsewhere. This was the first place that told me the answer. Thanks.

  2. Please tell me that youre going to maintain this up! Its so great and so crucial. I cant wait to read much more from you. I just feel like you know so considerably and know how you can make men and women listen to what you’ve to say. This blog is just too cool to be missed. Great stuff, actually. Please, PLEASE maintain it up!

  3. Can I just say, this blog is what got me by way of the day nowadays. Each time I read it, I just get more and more excited about whats next. Really refreshing weblog and really refreshing ideas. Im glad that I came across this when I did. I enjoy what youve got to say as well as the way you say it.

  4. This is one of the most incredible blogs Ive read in a extremely long time. The quantity of data in here is stunning, like you practically wrote the book on the subject. Your weblog is fantastic for everyone who wants to realize this subject far more. Fantastic stuff; please keep it up!

  5. This is among the most extraordinary blogs Ive read in a quite lengthy time. The amount of information in here is stunning, like you practically wrote the book on the subject. Your blog is fantastic for everyone who wants to recognize this subject a lot more. Wonderful stuff; please maintain it up!

  6. This weblog has certainly changed my perspective on this subject. Theres no way I wouldve thought about it this way if I hadnt come across your blog. All I was doing was cruising the web and I found your blog and all of a sudden my views have changed. Good on you, man!

  7. Why didnt I think about this? I hear specifically what youre saying and Im so pleased that I came across your weblog. You actually know what youre talking about, and you created me feel like I ought to discover a lot more about this. Thanks for this; Im officially a enormous fan of your blog.

  8. The next time I read a weblog, I hope that it doesnt disappoint me as considerably as this one. I mean, I know it was my selection to read, but I in fact thought youd have some thing fascinating to say. All I hear can be a bunch of whining about some thing which you could fix if you werent too busy seeking for attention.

  9. For what its worth, the layout is certainly remarkable. You know the way to balance writing and images/videos. Even so, I cant get over how little you in fact bring to light here. I think that everyones said the same thing that youve said over and over again. Dont you believe its time for some thing far more?

  10. Im not going to say what every person else has already said, but I do wish to comment on your knowledge of the topic. Youre genuinely well-informed. I cant believe just how much of this I just wasnt conscious of. Thank you for bringing far more info to this topic for me. Im truly grateful and genuinely impressed.

  11. This is certainly a weblog worth following. Youve got a fantastic deal to say about this subject, and so significantly understanding. I believe that you simply know the best way to make individuals listen to what you have to say, especially with an problem thats so important. Im glad to know this blog. Two big thumbs up, man!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s