Thursday, February 4, 2010

Alpine, Gmail, and SSH. How to make your computer send emails when you're not there!

Out of the many things I've learned in the past half year about using Linux, I find the concept of remote access of my computer through SSH to be the coolest.  Periodically I will be away from home, and I'll realize that I need access to some file on my computer so that I can send it to someone.  I recently learned how to set up a Secure Shell Server on my Ubuntu Linux laptop that I can access from my Android cell phone using an Android app called ConnectBot.  Once I get into my computer, I can then open up a fantastic text-mode email program called Alpine and compose emails with files attached right from my computer's hard drive and then send them through my Gmail account.  Nothing makes me feel more like a huge nerd than this!

Here's how I set up an SSH server and then install Alpine with access to my Gmail account (my Gmail is setup to check and respond from 2 additional email addresses, so the instructions are tailored to that scenario):

Setting up openSSH

First you need to install the openSSH server.  Easily enough you just have to type in sudo apt-get install openssh-server into your terminal to get the server.  Amazingly, it's ready right away to be used!   I wanted the SSH server to use a different port than the default (port 22), so I opened up /etc/ssh/sshd_config and changed the port number on the 5th line to something that was wacky enough not to be predictable.

Next came two considerations: (1) I'm behind a router, and therefore needed to set-up port forwarding so that I'd be able to access my openSSH server remotely.  If you have a router and forget this step then prepare for lots of frustration!  (2) Even having port-forwarding set-up, who wants to remember and type in an IP address so that you can connect to your server?  So I needed to sign up for a free dynamic hosting service that would give me a constant host name regardless of my IP address.

Setting up Dynamic DNS hosting

I found a great tutorial on the Ubuntu Help Site for setting up Dynamic DNS hosting for your computer.  Basically, I went to DynDNS, set-up an account for my computer, and then followed the instructions on the above-mentioned Ubuntu Help Site to install and configure ddclient.  ddclient will periodically send updates to DynDNS so that the hostname they provide you with always points to your IP address.  When you're done configuring all of this, you will then have a host-name pointing to your computer such as tommy.gotdns.com.  That's a lot easier to remember than 40.831.391.33 right?

Initial installation and set-up of Alpine

Next I set-up Alpine.  Installing it was easy enough: sudo apt-get install alpineOnce it's installed, you have to set it up to work with your Gmail account.  Refer to this tutorial from the University of Virginia for a tutorial on how to do that.  Be sure that when you're in the Config screen of Alpine, look for the field named Inbox Path and enter in the following: imap.gmail.com/ssl/user=username@gmail.com .  Be sure to replace 'username' with your own Gmail account username.  This will make sure that when you start-up Alpine and go into your Message Index, you will see the emails in your Gmail Inbox right away, instead of having to navigate to that inbox.

Configuring Alpine to send emails using different 'From' email addresses

Now, when I reply to emails that I've picked up using my Gmail account, I usually want to reply using different email accounts.  When you're only using the web-based Gmail checker, it allows you to respond using the account that the email was downloaded from.  I wanted to have that same functionality in Alpine.  This is where the Alpine concept of a Role comes in handy.  From the main screen of alpine, type the following keys (don't type the triangular brackets): S > R > R > A .  This will bring you to a screen that allows you to set-up the conditions under which Alpine will let you send an email using a different From email address. 

First, set a nickname up for your role; maybe the name of your email provider (i.e. Sympatico).    Next, under Current Message Conditions and beside To Pattern put one of the (or the only) email address(es) that Gmail is checking for you (e.g. bill@sympatico.ca).  This creates an expectation that whenever this email address is in the the To field of an email, Alpine will do whatever you tell it in your role.

Then, under Actions Begin Here and beside Set From put your name and then email address that Gmail is checking for you (e.g. Bill Nye <bill@sympatico.ca>).

Finally, under Uses Begin Here you need to make the following changes (if necessary): (1) Under Reply Use = make sure to highlight and press enter on Without Confirmation and (2) Under Compose Use = make sure to highlight and press enter on With Confirmation.  This will make it so that if someone emails you at bill@sympatico.ca, when you reply to that email, Alpine will automatically put bill@sypmpatico.ca in the From email address and not bill@gmail.com.

When you're done, you can press E to exit the Role set-up.  If you check two email accounts through Gmail like me, press A once more when you're in the Setup Role Rules screen in alpine and repeat the above instructions to set-up a role for your other email account.

Saving your Gmail password in Alpine so that it doesn't prompt you all the time

Finally, you'll probably be annoyed with entering in your Gmail password every time you start up Alpine.  Thanks to a helpful user on Ubuntu Forums, I found out a simple way of making Alpine save your password.  Open up your terminal, change directories to your home directory, cd ~/, and then type in touch .pine-passfile.  After that, run Alpine.  It will ask you for your password on start-up, and on sending an email, only to save your password indefinitely so that you no longer have to type in your password all the time.
 


Conclusion


Wow, those were a lot of very little steps which, put together, seem mountainous.  However, now I can punch in my dynamic DNS hostname into ConnectBot on my Android cell phone, access Alpine and send emails with files attached right from my computer's hard drive!  I also like that I can update my databases on the fly with important personal info, manage, and even turn my computer off from afar.  It's quite neat and if you're into feeling nerdy, I highly recommend getting your own openssh server configuration.

32 comments:

  1. That's motivating. Keep it up.

    ReplyDelete
  2. Since you seem to be knowledgeable about Alpine, do you know how I can send an HTML message via Alpine?

    ReplyDelete
  3. Alpine doesn't allow HTML composition, but at least can recognize HTML links when it sees them in your inbox.

    ReplyDelete
  4. Awesome development feature! Glad to know about this feature, and i want to make the best use of it.

    ReplyDelete
  5. This topic is great. I am looking for this and you really explained it well. Thanks for posting it and I will try to apply this for my site. website hosting services

    ReplyDelete
  6. But what about multiple account

    ReplyDelete
  7. But what about multiple account

    https://lusule.wordpress.com/2008/08/16/how-to-7/

    This involves setting up a rule called a "role". The individual smtp configurations are created within the role.

    Multiple IMAP or pop3 configurations are done by creating individual "collection lists".

    The article in the above link gives detailed instructions.

    ReplyDelete
    Replies
    1. For some reason the link takes you to Yahoo :- I ?????

      Copy and paste it into the browser URL box for the correct site.

      Delete
  8. The entire process can be done from the email portal as well by simply following a series of steps which has been pre-defined by the customer support team. http://800support.net/yahoo-support/how-to-contact-yahoo/

    ReplyDelete
  9. How to close Yahoo email address account

    You can later on unblock the contact as per the need of emails. For unblocking a contact on Yahoo mail, you only need to eliminate his or her email address from your Blocked Addresses list, proffering the various issues in your mail account. You can contact them anytime to obtain the long-lasting Yahoo customer care service support number.

    ReplyDelete
  10. Facing Password Recovery Issues with Yahoo Mail Account

    If you are facing any issues in the password recovery of your Yahoo mail account then you can contact our 24/7 Yahoo Technical Helpdesk for prompt assistance. Our Yahoo experts are reachable 24/7 and speak your native language.

    ReplyDelete
  11. How to secure Yahoo mail account via Phone number

    Sometimes to secure your Yahoo mail account,it is temporarily or permanently blocked.Yahoo is very easily to access multiple products up to their policies.If your account has been permanently delete,it is impossible to regain the access.Yahoo mail account is easily recover by contact Yahoo phone number.Get the unable access the Yahoo mail account so dial a contact Yahoo helpline number 1-800 for assistance.

    ReplyDelete
  12. How To Fix Yahoo Mail Connection Issues

    The firm has good year of experience in dealing with Yahoo mail connection issues and other related troubles of Yahoo. The company’s firm will never disappoint you when it comes to proffering the round the clock tech Yahoo support solutions. Just get allied with the firm anytime and obtain the ultimate Contact Yahoo Phone Number within a short duration of time slot.

    ReplyDelete
  13. How Do I Call Yahoo Live Phone Number

    You can give a call on the Yahoo Phone number anytime you feel like to attain the solutions at a reasonable rate. The number gives you the complete freedom to attain the quality tech support Yahoo solutions in a right manner. Just give a call on the number anytime you feel like and attain the exceptional Yahoo tech support solutions.

    ReplyDelete
  14. Recover Yahoo Mail Password on Computer

    Want to recover or reset the password? Well! Just be relaxed as Yahoo gives an option in the form of “Sign in Helper” and you can reset the Yahoo password recoveryonce again if you have provided recovery email address and recovery mobile phone. Go to the “Sign-in helper” and click on “Trouble signing in” then follow the on-screen instructions and get the access to your Yahoo account on computer. If you can’t get in then, contact our certified Yahoo Technical Support Helpdesk for assistance.

    ReplyDelete
  15. Consult Yahoo helpline Support Team

    Don’t expect any instant response or support from them as they have a huge database of active users worldwide and providing support to everyone at a time is no picnic. For quick response and resolution contact our certified Yahoo helpline Support Team.

    ReplyDelete
  16. How To Scan Your Yahoo Mail Account For Common Problems

    Yahoo users don’t need to get worried at all because now they can use quick fix tool for resolving common problems in Yahoo. With the help of the quick fix tool, you can scan your account for the problems like an issue in sending or receiving email, temporary access error code, and much more, resolve any issue via Yahoo phone number. The scan will usually take some hours and it will automatically correct an issue.

    ReplyDelete
  17. Yahoo Helpdesk Support Service To Resolve Yahoo Mail Issues

    Are you getting issue while using Yahoo Mail? Or are you unable to recover your Yahoo account? Yahoo is quite popular and has a huge database of active users worldwide but users have been reporting issues frequently. Although, Yahoo offers excellent customer support through social media like Facebook, Twitter and Yahoo Help Forums etc but lacks instant support and resolution via Yahoo contact number.

    ReplyDelete

  18. Find the Hotmail Customer service number 1-800

    Hotmail technical issues get resolved via Yahoo customer service supportUSA : 1-888-470-9705

    ReplyDelete
  19. You must disable the anti-virus, add-ons, and firewalls if you think they may be disrupting the Yahoo mail. If the problem still persists, then get in touch with our certified Yahoo technicians on our toll-free Yahoo customer care number for the complete solution to your Yahoo account.

    ReplyDelete
  20. Sync Yahoo calender on android

    Synchronization of Yahoo calender on iPhone automatically updates any changes made on both the device and your Yahoo account.If you need any technical hassle or other problem,feel free to call Yahoo technical support helpline number.

    ReplyDelete
  21. This comment has been removed by the author.

    ReplyDelete
  22. Set Up SMTP Settings in Hotmail account

    Are you looking for SMTP setting in Hotmail account? Hotmail SMTP servers are the outgoing servers, the SMTP server allows you to send emails through your Hotmail accounts or outlook.com from any email,call to our technician support team Hotmail technical toll free phone number.

    ReplyDelete
  23. How to Install Multiple Skype on Mac

    If you want run multiple Skype accounts at a same time on System,Please contact online support expert just call Skype Customer Service Number 1-888-841-6062.

    ReplyDelete
  24. Fix Authentication Failed Message for MSN Account

    Get the "Authentication failed error" message for msn mail for technical issues to your account,setting issues,network issues or change the password or username etc.If you find the fix error message to get solution via MSN customer support phone number 24/7 and get the fixed error for MSN account.

    ReplyDelete
  25. How To Get Instant HP Support?

    Hello friends, if you are looking for HP helpline number for instant support, then dial our toll-free number and talk to expert.

    ReplyDelete
  26. Thanks for sharing such a useful information. Today hosting has become highly competitive field and every firm wants to attract customers by offering lucrative web hosting plans.
    Web Hosting India

    ReplyDelete
  27. Yahoo Support Phone Number
    http://www.yahoosuppotphonenumber.net/
    The customer can seek a solution to any kind of problem in minimum time.
    If your problem is too big to handle you can get a live chat with our technician
    you can interact with them the way you want.We provide 24*7 technical support for yahoo mail.
    Our yahoo customer service has been liked and loved by many and that's why we have a large customer base.
    Feel free to share and get resolved an issue any time any where by letting our technical support team for
    yahoo mail to know that.
    We are always glad to serve you.

    ReplyDelete