Howto handle mailto link with gmail account on Ubuntu

รูปที่ 1) ตั้งค่า mail reader

ตั้งแต่คบกับ Google Apps ลืมไปเลยว่า mail-client คืออะไร Eudora, Outlook, Mercury Mail, Pegasus Mail หรือ Mozilla Thunderbird หน้าตาเป็นยังไงบ้างแล้วก็ไม่รู้ แต่ถึงแม้จะไม่ได้ใช้งานแล้วก็ตาม เวลาเข้าไปที่เว็บต่างๆที่มี link mailto: พอคลิกปุ๊บมันก็จะไปเรียกโปรแกรมที่เป็น mail-client ขึ้นมา แม้กระทั่งใน Ubuntu มันยังเรียก Evolution ขึ้นมาให้ (ไม่ได้ใช้เลย เพราะ calendar ก็ใช้ของ Google)

จริงๆแล้วเราสามารถ handle ไอ้ mailto นี้ได้ ให้มันไปใช้ gmail แทน ตามนี้

  1. ใน Gnome Desktop ไปที่ System -> Preferences -> Preferred Applications
  2. เลือก Mail Reader เป็น Custom แล้วใส่คำสั่งเป็น mailto.sh %s ตามภาพที่ 1
  3. สร้างไฟล์สคริปต์คำสั่งไว้ที่ /usr/local/bin ตามนี้
1
2
3
cd /usr/local/bin
sudo wget http://chet.printhong.net/files/mailto.sh
sudo chmod +x mailto.sh

ถ้าใครอยากรู้ว่าข้างในมันเขียนว่าไงบ้าง ก็ตามนี้เลย

1
2
#!/bin/sh
firefox "https://mail.google.com/mail?view=cm&tf=0&to=`echo $1 | sed 's/mailto://'`"

ทดสอบ คลิก

ใส่ความเห็น

อีเมล์ของคุณจะไม่แสดงให้คนอื่นเห็น ช่องที่ต้องการถูกทำเครื่องหมาย *

*

คุณอาจจะใช้ป้ายกำกับและคุณสมบัติHTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Twitter Users
Enter your personal information in the form or sign in with your Twitter account by clicking the button below.