Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 636
  • Last Modified:

Sending mail with attachments in PHP

How can I send an e-mail with an Excel file attached to it?

I am running PHP on windows with Apache.

Thanks
0
perrosucio
Asked:
perrosucio
  • 4
  • 3
1 Solution
 
peyoxCommented:
You can use php mailer class: http://phpmailer.sourceforge.net/ (see example at the bottom)
0
 
perrosucioAuthor Commented:
Got the complete class (I download it)

I was browsing the "class.phpmailet.php" and on line 115 shows a path in UNIx notation.

Do I have to change this to a path in windows?

Another thing. Just by using this phpmailer package I will be able to send e-mails? This means  I don't have to do anything with php.ini or other files?

Thanks

Andy
0
 
peyoxCommented:
Copy these files into one folder:

class.phpmailer.php
class.smtp.php
phpmailer_test.php
phpunit.php

then in your browser run: http://localhost/emailtest/phpmailer_test.php

emailtest - change to apropriate folder
then supply To address and smtp server.

Don't worry about unix paths, this is because this class may be used in windows or unix environments, in your case - windows.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
perrosucioAuthor Commented:
I did what you told me and received this:

Test results:
test_wordwrap FAIL
test_low_priority FAIL
test_multiple_plain_fileattachment FAIL
test_plain_stringattachment FAIL
test_quoted_printable FAIL
test_html FAIL
test_html_attachment FAIL
test_embedded_image FAIL
test_multi_embedded_image FAIL
test_altbody FAIL
test_altbody_attachment FAIL
test_multiplesend FAIL
test_smtpkeepalive FAIL
test_error FAIL

14 tests run
14 failures.


test_wordwrap
Language string failed to load: instantiate
test_low_priority
Language string failed to load: instantiate
test_multiple_plain_fileattachment
Language string failed to load: file_accessrocks.png
test_plain_stringattachment
Language string failed to load: instantiate
test_quoted_printable
Language string failed to load: instantiate
test_html
Language string failed to load: instantiate
test_html_attachment
Language string failed to load: instantiate
test_embedded_image
Language string failed to load: file_accessrocks.png
test_multi_embedded_image
Language string failed to load: file_accessrocks.png
test_altbody
Language string failed to load: instantiate
test_altbody_attachment
Language string failed to load: instantiate
test_multiplesend
Language string failed to load: instantiate
Language string failed to load: instantiate
test_smtpkeepalive
Language string failed to load: instantiate
Language string failed to load: instantiate
test_error
(expected/actual)

You must provide at least one recipient email address.
--------
Language string failed to load: provide_address
Send failed

I don´t understand about SMTP?? Where can I check this??
0
 
peyoxCommented:
You should have smtp server address from your email provider, ie. smtp.gmail.com or something. Some of them reuqire authentication. You have to check this out.

Couple words about how smtp works: http://computer.howstuffworks.com/email5.htm
0
 
jeffparisCommented:
People don't help much when it is only 50 points, dude.
0
 
perrosucioAuthor Commented:
Hi,

I am trying with the php mailer but I am getting the following warning:

Warning: fsockopen(): unable to connect to smtp.digitel.com.ve:25 in C:\working\TIM\class.smtp.php on line 105
Message was not sent
Mailer Error: Language string failed to load: connect_host

I don't know what else to do.

Andy
0
 
perrosucioAuthor Commented:
everything ins working fine.

Thanks a lot for all the help.

Andy
0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now