Monday 9 February 2009

Trying to get mail working in local web development environment

This morning I read a bit more of the canon lens forums on dpreview, then I went on Flickr and noticed I had a big notice saying that because I'm only on a free account only my last 200 pics will be visible in my photostream. Any older photos I've linked to should still be visible on my blog etc. But I won't be able to access them from within Flickr.

I don't want to upgrade to a pro account since Flickr requires that you must link back to them, and on sites like dpreview you can't wrap images in links. I think I'll probably just use the blogger/google/picassa image storage for the moment, then when I get my photo website done (probably be ages until I get that done) I'll just upload the photos there. Then I can link to them and do whatever I want with them, and don't have to worry about Yahoo going bust or Blogger starting charging for image storage etc.

I bought a load of stuff this morning, so that took some time and cost loads. But I do love stuff.

I checked my spleenmail.

Then I tried to update my test site on the webserver, but when I tested the site it didn't work properly - the .htaccess file with the rewrite rules was missing. I had updated the site using FileZilla in Windows, I first downloaded the files from Ubuntu to Windows, then uploaded them from Windows to the web server. I found the problem was that Filezilla couldn't see the hidden .htaccess files in Ubuntu.

After doing some googling I found this helpful thread over at the Ubuntu forums: Howto: Easy FTP with vsftpd. I just needed to add force_dot_files=YES to /etc/vsftpd.conf.

But then I had trouble restarting vsftpd. I was getting an error 500 OOPS: vsftpd: cannot open config file:restart when I tried to restart it. Again, I found my answer in a helpful thread over at the Ubuntu Forums: vsftpd won't restart. You just need to include the full path to vsftpd when executing it.

I did a bit of work on my website, then it was lunchtime.

After lunch I did some more work on my website, then started checking my email, then played on Animal for a bit, and then finished checking my email. I did a bit more work on my website. I was trying to make it so that the contact form would automatically fill out your email address if you were logged in to the site. But I was having with AES_DECRYPT not decrypting the email address.

After much messing about, I found the problem was that I had manually changed the username in PHPMyAdmin, and since the username was used as part of the key for decrypting the email address, it wouldn't decrypt since the username was different to what the email address was originally encrypted with.

So then I had to try and register a new user (well actually I deleted my current user and tried to register the same one again). But when I tried to register, the email wouldn't send. First of all I tried to find the php.ini file so I could check the SMTP settings in it. But I didn't know where the php.ini file that was in use was. I found out where it was by running phpinfo(), then it has an entry for 'Configuration File (php.ini) path' and 'Loaded Configuration File'. I found it was saved in /etc/php5/cgi/.

After looking at php.ini it seemed the SMTP settings were just for windows, and the only setting for Linux was the sendmail path. So I did some googling and installed sendmail. However, after getting that setup and trying to register, the site said that the email was sent, but I didn't receive it.

I read that you probably need to send the mail to your ISP's SMTP Server for them to send out as they probably block you from sending mail yourself to prevent spam. So after some more googling I found this thread at the Ubuntu forums How to properly install SendMail.

I had to cook dinner as Rad had gone to Hospital to see Granny, so that took quite a while.

After dinner I watched 'The Bourne Ultimatum' with Mac and Ben. Then I did some more work trying to get email to work. I installed Exim following the instructions on the Ubuntu forums. Then I had to uninstall sendmail since it was using port 25 so Exim couldn't use it.

After getting that setup I tried to register again and the email still didn't send. I looked at the Exim log (/var/log/exim4/mainlog) and saw that Exim was working okay but my ISP was rejecting the email as it wasn't from a real domain name. I guess another anti-spam measure. But weirdly with windows you don't have to set a real domain name anywhere for email to work.

Anyway, after much more testing and googling I found that if I used a real domain name when configuring Exim, then the email would send okay. But this seems a bit weird to do this when you don't need to on windows, so I posted to the web squeeze in the hope that someone can help me there.

Food
Breakfast: Lemon marmalade toast sandwich; cup o' tea.
Lunch: ½ Bacon with Tom Ketch sandwich; clementine; banana; chocolate digestive bar; cup o' tea.
Dinner: Chicken & Asparagus pie; mixed veg; jacket potato. Pudding was a yoghurt with malted milks. Coffee; crinkle crunch biscuit; choc chip digestive.

No comments: