-1

Is it possible to generate an email and add this email to another email's attachment?
I have only found ways to add files like pdf or jpeg but not a mail.

EDIT: my problem is that I can't store the email on the server to add it to the attachment

Veve
  • 6,643
  • 5
  • 39
  • 58
Sysix
  • 1,572
  • 1
  • 16
  • 23
  • 4
    Possible duplicate of [Add attachment through PHPMailer](http://stackoverflow.com/questions/17776126/add-attachment-through-phpmailer) –  Jan 10 '17 at 10:30
  • no im sorry, my problem is that I cant store the email on the server to add it to the attachment – Sysix Jan 10 '17 at 10:40
  • Search first how to save an email as a file on your server, sending it after won't be a problem. – Veve Jan 10 '17 at 10:46
  • Why do you need it to store it? If you have the File or Blob object from the client side you can just upload it along with the form to your backend. Then you just retrieve it on the fly and attach it to the email. – Sebas Jan 10 '17 at 10:48
  • @Veve yes your right. I searched for it, but maybe not good enough. – Sysix Jan 10 '17 at 10:58
  • @Sebas The mail attachment is the mail which was sent before to the user. The mail will be send to an admin – Sysix Jan 10 '17 at 11:00

1 Answers1

1

As the comments say, it's exactly like adding any other attachment, and it's up to you to get the message into a suitable external text file (or string).

The only differences are that external email messages are usually saved with a .eml extension, and should use the message/rfc822 MIME type, which PHPMailer knows about and will set automatically given a file with a .eml extension.

Synchro
  • 35,538
  • 15
  • 81
  • 104
  • after a little search of google I found a method to generate the .eml file. The Extension-Name was the missing Search-Key :) – Sysix Jan 10 '17 at 22:38