Showing posts with label Attachments. Show all posts
Showing posts with label Attachments. Show all posts

Thursday, December 30, 2010

PHP: Send Mail with Attachments using Local Mail Server

I have modified some codes from the forums for sending email with attachments using local mail server. This script is tested with Gmail and Hotmail. Both mail servers are able to receive the emails.

However, when I include the attachments in the sending mail, Hotmail accounts are unable to receive them. As for Gmail accounts, there are no problems at all.

I am still trying to find out why Hotmail is unable to receive the attachments. If anyone knows how to solve the problem, do let me know. 



You can download the PHP files for the class here and the class tester here.
Alternatively you can visit my website here.


As usual, here are some snapshots of the output and the code:


1. Message received by Gmail.


2. Message output from server.










Codes:





























Monday, December 20, 2010

PHP: Gmail Class

I have created a class for Gmail using PHP.This class allows file attachments to be automatically downloaded into your server file directory.
Currently, I am still writing the functions for sending mail.

Do take note that in order for the server to be able to access gmail, imap-ssl must be configured for your PHP. You can check whether imap-ssl is installed by running a PHP which contains phpinfo(). Under the 3rd column, Configure Command, you should be able to see: ' --with-imap-ssl'
If you do not see that, please reconfigure your PHP installation to include that.

You can download the PHP files for the class here and the class tester here.
Alternatively, you can visit my website here.

Here are some snapshot of the output and the codes.

Output:

When there is a same file in the directory in which the file is to be downloaded into.
The 2nd one shows a file being downloaded.



Here are some snapshots of the code...

















This is the PHP to test the Gmail Class