I’m trying to configure an incoming email service for receiving issues via email in a Redmine server for a company.
The company uses Lotus Notes and for security reasons, I cannot read email using POP3 or IMAP, only with notes client or notes iWeb. I need an account (firstname.lastname@example.org) but the company does not generate generic accounts. I neither can use a Gmail account, because they use an authenticated proxy and it’s not possible to check the gmail account (neither I can check another user’s account in the same company). Crazy!
I don’t need to send mails from this account. At least I can use their SMTP server to send the redmine’s mails.
The solution is to create a local mail transfer agent (I’ll use Postfix) in the server where redmine is installed, create a local mail account (email@example.com), and then redirect all the mail from the user account that administers the redmine to this local account. A bit convoluted, I know, but I have no other choice.
Postfix is a well known Mail Transfer Agent (MTA), and it’s an alternative to the also widely used Sendmail MTA. We’ll use also Courier IMAP and Courier POP3 to retrieve emails. If you want a more detailed explanation, have a look at this Ubuntu HowTo:
In this post I will focus only on the installation and configuration process. This is a schema of our final result (taken from the Ubuntu HowTo):
The first step is to install postfix:
$ sudo apt-get install postfix
You’ll be prompted for your server type. Choose “Internet site”:
And then enter your domain name (example.org, or in my case l3-ubuntu-12.com):
Once installed, edit the /etc/postfix/main.cf file and add this lines at the end of the file:
inet_protocols = ipv4 home_mailbox = Maildir/
We are telling postfix to use IPv4 protocol, and that the folder where the mail will be saved (home/username/Maildir). Extract from the Ubuntu HowTo:
Maildir is a format for an e-mail spool that does not require file locking to maintain message integrity because the messages are kept in separate files with unique names. A Maildir is a directory (often named Maildir) with three subdirectories named tmp, new, and cur. The subdirectories should all reside on the same filesystem.
Another reason to use Maildir format is that Courier IMAP/POP3 servers only work with Maildir format of mailboxes.
Restart postfix to get the new configuration:
$ sudo service postfix restart * Stopping Postfix Mail Transport Agent postfix [ OK ] * Starting Postfix Mail Transport Agent postfix [ OK ]
Install Courer POP3 and Courier IMAP
To retrieve the emails from our MailBox, we’ll to install Courier POP3 and Courier IMAP:
$ sudo apt-get install courier-pop
When prompted for creating web-based administration directories, answer No:
Then install Courier IMAP:
$ sudo apt-get install courier-imap
To make some tests sending emails, we need a mail client. Bsd-mailx is a simple command-line mail client:
$ sudo apt-get install bsd-mailx
Install Mozilla Thunderbird
Finally, to make the final tests, we’ll install Mozilla Thunderbird. If you haven’t already installed, just type:
$ sudo apt-get install thunderbird
Testing the installation
First of all, test your mail server:
$ telnet localhost 25 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. 220 l3-ubuntu-12 ESMTP Postfix (Ubuntu) quit 221 2.0.0 Bye Connection closed by foreign host.
Lets create some users to test our mail server. Answer the questions to create the users:
$ sudo adduser user1 $ sudo adduser user2
Now change to user1 and send an email to user2:
- To send a mail to user2, type mail user2
- Write the subject of the email and press [Enter]
- Write the body of the email and press [Enter]
- To send the mail, write a dot (.) and press [Enter]
$ su user1 Password: user1@l3-ubuntu-12:/home/user1$ mail user2 Subject: test mail from user1 This is a test mail from user1 . EOT
Now check if the email has arrived to user2. To avoid the “Cannot open display” message:
$ su user2 Contrasenya: user2@l3-ubuntu-12:/home/user2$ thunderbird No protocol specified No protocol specified No protocol specified No protocol specified Error: cannot open display: :0
switch to user2 with sux. Sux is a wrapper around su to transfer your X credentials, thus you can open Thunderbird with user2 (install with sudo apt-get install sux):
$ sux user2 Password: xauth: file /home/user2/.Xauthority does not exist user2@l3-ubuntu-12:/home/user2$ thunderbird
Open Thunderbird and create a new account:
Press Skip this and use my existing email:
Enter the user2 account settings:
Press Continue. If you get this error:
Thunderbird failed to find the settings for your email account
Then restart postfix and try again:
$ sudo service postfix restart
Now the configuration must be retrieved. I choose the POP3 configuration for my email account:
And press Done. You get this warning screen because we are not using encryption (maybe in a later post, for the purpose of testing the email it’s enough with this). Check I understand the risks and press Done.
If you try to send a message you’ll get this error:
You have to get the local certificate and confirm the security exception to send mails:
And now just pray for this to work in the foo company!
Do you liked this HowTo? PLease leave your comments below.
As you may know, UbuntuOne file services will be shutting down as of 1st of June (http://blog.canonical.com/2014/04/02/shutting-down-ubuntu-one-file-services/).
You can download now all the files loggin in to your account. This welcome screen is displayed:
And you can download all your stuff in. Just get the downloader for your OS, uncompress it and execute the u1_downloader. You’ll be prompted for your username/password and then the download begins:
$ ./u1_downloader U1 email: ubuntuoneusername U1 password: ubuntuonepassword Total: 2164761533 bytes [...]
Hurry up, you only have until 31 July 2014. After that date, all remaining content will be deleted!
Please, leave your comments below.
There’s a unusual command in SQL*Plus that may be useful under certain circumstances: the COPY command (http://docs.oracle.com/cd/E11882_01/server.112/e16604/apb.htm).
Although this command will be obsoleted in future releases of SQL*Plus, Oracle has been saying the same since (at least) Oracle 9, and it’s still available in Oracle 11gR2.
I need to copy a table from one database to another database, and I don’t want to do an export/import of the table.
A simple copy of the table is enough for me:
miquel@db_2> copy from otheruser@db_1 create my_table using select * from other_table; Enter FROM password: Array fetch/bind size is 1000. (arraysize is 1000) Will commit when done. (copycommit is 0) Maximum long size is 2000000000. (long is 2000000000) Table MY_TABLE created. 55481 rows selected from otheruser@db_1. 55481 rows inserted into MY_TABLE. 55481 rows committed into MY TABLE at DEFAULT HOST connection.
It’s that simple!
Feel free to comment below.
Oracle 11g introduces a new security feature: case sensitive passwords.
Case sensitive passwords may cause problems if you run an old version of Oracle Forms (6i in my case) with an Oracle 11g database. The LOGON built-in sends the password to the database un UPPERCASE, so if the passwords doesn’t match, you cannot login to the database.
To disable case sensitive passwords in oracle 11g you have to modify the SEC_CASE_SENSITIVE_LOGON initialization parameter:
SYSTEM@mydb> show parameter SEC_CASE_SENSITIVE_LOGON NAME TYPE VALUE ------------------------------------ ----------- ------------------------------ sec_case_sensitive_logon boolean TRUE SYSTEM@mydb> alter system set sec_case_sensitive_logon=false;
To enable case sensitive passwords again, revert back to true.
Please, leave your comments and suggestions below.
I’m getting errors of block corruption in the alert.log of an Oracle 11g Release 2 test database:
Exception [type: SIGSEGV, Address not mapped to object] [ADDR:0xFFFFFFFA7DBAF398] [PC:0x896E0BE, kcbgcur()+3026] [flags: 0x0, count: 1] check value in block header: 0x46c2 computed block checksum: 0x0 Reading datafile '/app/oracle/oradata/database2/sgirgea_01.dbf' for corruption at rdba: 0x0a808912 (file 42, block 35090) Reread (file 42, block 35090) found same corrupt data (no logical check) Corrupt Block Found TSN = 46, TSNAME = SGIRGEA RFN = 42, BLK = 35090, RDBA = 176195858 OBJN = 0, OBJD = 258730, OBJECT = SGIRGEA, SUBOBJECT = SEGMENT OWNER = , SEGMENT TYPE = Temporary Segment Hex dump of (file 42, block 35218) in trace file /app/oracle/diag/rdbms/database1/database1/trace/sid_w000_23395.trc Corrupt block relative dba: 0x0a808992 (file 42, block 35218) Bad header found during buffer read Data in bad block: type: 35 format: 2 rdba: 0x01408992 last change scn: 0x0000.000b6126 seq: 0x3 flg: 0x04 spare1: 0x0 spare2: 0x0 spare3: 0x0 consistency value in tail: 0x61262303 check value in block header: 0xcffd computed block checksum: 0x0
In this case it’s not a data corruption, I’ts due to a silly mistake in the creation of a tablespace.
I have two databases created on the same server (it’s a test server), and the datafiles of the two databases in different folders:
- /app/oracle/oradata/database1: datafiles of the database 1.
- /app/oracle/oradata/database2: datafiles of the database 2.
I’m testing an application with different database configurations. So, I created this user in database 1, with its own datafile, but by mistake I created the datafile on /app/oracle/oradata/database2, the folder for the other database’s datafiles.
Then, I did the same for the database 2, created the same user, with its own tablespace, and now, I created the datafile correctly in its own folder (/app/oracle/oradata/database2), with the same name as the other database’s datafile. This is an illustration of this mistake:
When I noticed the error in the alert log, I performed a backup of the user on both databases. Then, dropped the user in database 1 to recreate it again, but when I try to delete the tablespace in database 1 I get this error:
SQL@database1> drop tablespace sgirgea; drop tablespace sgirgea * ERROR at line 1: ORA-01122: database file 42 failed verification check ORA-01110: data file 42: '/app/oracle/oradata/database2/sgirgea_01.dbf' ORA-01210: data file header is media corrupt
Trying to alter the tablespace to bring it offline doesn’t works:
SQL@database1> alter tablespace sgirgea offline; alter tablespace sgirgea offline * ERROR at line 1: ORA-01122: database file 42 failed verification check ORA-01110: data file 42: '/app/oracle/oradata/database2/sgirgea_01.dbf' ORA-01210: data file header is media corrupt
I try to bring the tablespace offline with the database mounted, but I can not shutdown the database for the same reason:
SQL@database1> shutdown immediate; ORA-01122: database file 42 failed verification check ORA-01110: data file 42: '/app/oracle/oradata/database2/sgirgea_01.dbf' ORA-01210: data file header is media corrupt
Prior to a shutdown abort, I tried to offline the datafile, instead of the tablespace:
SQL@database1> alter database datafile 42 offline; alter database datafile 42 offline * ERROR at line 1: ORA-01145: offline immediate disallowed unless media recovery enabled
But it’s not possible because the database is in NOARCHIVELOG mode, as this is a test environment.
Finally, I tried an offline drop of the datafile and it worked. Then just dropped the tablespace just including contents, not the datafile (without the “including contents and datafiles” clause, only “including contents“):
SQL@database1> alter database datafile 42 offline drop; Database altered. SQL@database1> drop tablespace sgirgea including contents; Tablespace dropped.
Then I checked for the datafile and it’s still there, and it’s correctly attached to database2, and everything works fine on database 2. Just have to recreate the same user in database 1 to continue testing.
Please, feel free to leave your comments below.
I’m trying to export a user on a Oracle 11g Relase 2 database (126.96.36.199) using my local client, Oracle 10.2.0.4.
With certain users I’m getting this error:
$ exp system@sid file=sgirgeaext_"$(date +%Y%m%d)".dmp log=sgirgeaext_exp_"$(date +%Y%m%d)".log consistent=Y statistics=none owner=sgirgeaext Export: Release 10.2.0.4.0 - Production on Fri Jan 31 11:13:33 2014 Copyright (c) 1982, 2007, Oracle. All rights reserved. Password: Connected to: Oracle Database 11g Enterprise Edition Release 188.8.131.52.0 - 64bit Production With the Partitioning and Real Application Testing options Export done in UTF8 character set and AL16UTF16 NCHAR character set About to export specified users ... . exporting pre-schema procedural objects and actions . exporting foreign function library names for user SGIRGEAEXT . exporting PUBLIC type synonyms . exporting private type synonyms . exporting object type definitions for user SGIRGEAEXT About to export SGIRGEAEXT's objects ... . exporting database links . exporting sequence numbers . exporting cluster definitions . about to export SGIRGEAEXT's tables via Conventional Path ... EXP-00008: ORACLE error 1455 encountered ORA-01455: converting column overflows integer datatype EXP-00000: Export terminated unsuccessfully
I tried also not to exporting indexes (indexes=N), as some other blogs suggested, but no luck.
This is due to the different versions of my client export and the database target.
I tried the same export using the 11gR2 client and the export finished without errors.
Thanks to all of you who have read and commented on my (our) blog!
The WordPress.com stats helper monkeys prepared a 2013 annual report for this blog.
Here’s an excerpt:
The Louvre Museum has 8.5 million visitors per year. This blog was viewed about 94,000 times in 2013. If it were an exhibit at the Louvre Museum, it would take about 4 days for that many people to see it.