Does anybody know a good example how to send mail with attachments and display a progressbar in JavaScript (jQuery)?
You're probably going to have to guess the amount of time it takes and update the progress bar based on that.
Given that PHP doesn't have threading, I would suggest having a database queue for deliveries, and have an external PHP process triggered from the main site (or via cron) that processes the deliveries on the side, marking on the database the current status on each delivery: NOT_PROCESSED, IN_PROGRESS, CONNECTING, CONNECTED, SENDING_DATA, ACCEPTED, FAILURE_X . You can query the database for the status on each delivery via Ajax.
If PHPMailer internally uses the standard PHP mail() function, which uses a relay SMTP server in your machine, you cannot have that much information about status (which you would have if you created the sockets yourself), you can have just three main states NOT_PROCESSED, IN_PROGRESS, FAILURE_X.
Is it possible to send mail asycronously using PHP while giving user feedback on delivery?
Otherwise maybe you could update the progress bar after each little step. Something arbitrary like this:
This, however, is really inefficient.. And the end result would probably be the user seeing the progress bar jump really fast through the first three (25%, 50%, 75%) and then be stuck on the 75% for a extra second or two and then be done..