Tag Archives: wamp server - Page 2

Sending email with attachment from localhost/WAMP Server using sendmail

PHPMailer and PEAR Mail supports sending attachment with email using their functions or extensions; but PHP’s own mail() function hasn’t any function separately to achieve this. Developers have to use their own code to attach file within email’s body to do so.

PHP’s mail() function can be used with sendmail.exe to send email from localhost/WAMP Server and I have already posted an article about it; so to configure it, refer to that article. This article will cover only the PHP code for sending email with attachment(s).


The “else” part in the above code might never get executed because mail() function will not return false when used with sendmail.exe; so might not get the error/reason if you don’t receive email.

Don’t try to send email from Yahoo!’s free email account, because it is not allowing users to send email using its SMTP server from other email clients or other such facilities (like this, specified in this article), only premium/paid members can use external resources than Yahoo! Mail to send emails.


Rate this article

9 votes, 3.67 avg. rating (74% score)