air
air

Reputation: 6264

attach pictures with emails php

I want to send email with php mail function, where I can also attach two pictures (.bmp , .gif, jpg , .png, .jpeg) only from the form without storing into any folder of website.
I tried many scripts but nothing is working correctly.
Can you tell me how to do it?

Upvotes: 2

Views: 2689

Answers (1)

mario
mario

Reputation: 145482

You should not use the basic mail() function for that. Try one of the more featureful PHP classes for sending mails with attachments: PhpMailer vs. SwiftMailer?

  • Create mail object
  • Add image file as attachment.
  • Add content as HTML with image name as reference.

You need to concretise your problems when you have any. Nobody can help you with "but all is not working properly" unless you present some code and a detailed description.


If you want to do it tediously by hand, you can certainly use mail(). But it is more involving. Here are a few tutorials:

Please don't forget to show us your ready solution too if you really go that way.

Upvotes: 1

Related Questions