script to set variables based on user input
Posted: Tue Dec 29, 2009 6:42 pm
I am using the mew email reader in emacs. The reader accesses your pop accounts based on lisp variables you set in its configuration file. I am trying to write an interactive function which will set these variables based on user input (e.g. type 'y' for yahoo account, 'm' for msn, etc...) When I run the function below it ends up executing the else statement that 'the email account does not exist'.
Just from doing some rudimentary debugging i think the problem is that the user-entered character is being interpreted as an integer. I tried a function to convert an integer back to a character, but the function was void (int-char).
Just from doing some rudimentary debugging i think the problem is that the user-entered character is being interpreted as an integer. I tried a function to convert an integer back to a character, but the function was void (int-char).
Code: Select all
(defun popmail (account)
"check the specified popmail account for mail"
(interactive "cWhich account should I check? ")
(if (char-equal account "y")
((setq mew-smtp-server "smtp.mail.yahoo.com")
(setq mew-pop-user "rubinglen")
(setq mew-pop-server "pop.mail.yahoo.com")
(setq mew-pop-auth 'pass)
(setq mew-pop-port nil)
(setq mew-pop-ssl t)
(setq mew-smtp-ssl t)
(setq mew-smtp-port 465)
(setq mew-pop-ssl-port 995)
(setq mew-ssl-verify-level 0))
(if (char-equal account "g") ; else part is another if
((setq mew-smtp-server "smtp.gawab.com")
(setq mew-pop-user "[email protected]")
(setq mew-pop-server "pop.gawab.com")
(setq mew-pop-auth 'pass)
(setq mew-pop-ssl t)
(setq mew-pop-ssl-port 995)
(setq mew-pop-port 110)
(setq mew-smtp-port 25)
(setq mew-smtp-ssl nil)
(setq mew-ssl-verify-level nil))
(message "email account does not exist"))));else the user entered the wrong letter