Then text and attachment sections can be specified within boundaries. A boundary is started with two hyphens followed by a unique number which can not appear in the message part of the email. A PHP function md5 is used to create a 32 digit hexadecimal number to create unique number. A final boundary denoting the email's final section must also end with two hyphens.
Malhar Lathkar. Syed Raza. Frahaan Hussain. Nivedita Jain. Azaz Patel. Vijay Kumar Parvatha Reddy. Previous Page. Next Page. The alternative answers can do with less then sloc. Dislike that the answer for "I want A" is answered with "No, use B its better". The other answers tell "A is done like this". I found this question looking for an answer how to use the mail function to add attachments. This answer does not help me do that. This isn't the answer to the question. This answer also ignores the license used by the project.
Show 13 more comments. Pragnesh Chauhan Pragnesh Chauhan 8, 9 9 gold badges 39 39 silver badges 52 52 bronze badges. I'm posting the comment on his behalf since he doesn't have enough rep to post comments and I've flagged the answer for deletion. From PHPMailer's docs There are myriad overlapping RFCs, requiring tight adherence to horribly complicated formatting and encoding rules - the vast majority of code that you'll find online that uses the mail function directly is just plain wrong!
I've used something like this answer to send mail with attachments and it worked! Only to find a few days later that while Gmail shows the attachments just fine, other providers show the base64 content directly inline in the mail. Show 9 more comments.
For PHP 5. Harshil Modi 1 1 gold badge 3 3 silver badges 13 13 bronze badges. Simon Mokhele Simon Mokhele 3, 3 3 gold badges 19 19 silver badges 21 21 bronze badges.
I thought the variables were descriptive enough to declare and institution them — Simon Mokhele. This finally worked after a headache of trying to get the stupid phpmailer thing to work. This one actually worked. The accepted answer was not working for me. It would send over the file corrupted.
This is a very clear and clean answer. It works when received by Outlook, Gmail alike. Neat answer. If you can update with HTML message part, this will become more complete. Show 15 more comments. Matthew Johnson Matthew Johnson 4, 2 2 gold badges 36 36 silver badges 49 49 bronze badges. Is PHPMailer not 3rd-party? Xsmael, PHPMailer is definitely 3rd party : I disagree with the downvotes, as at least at the time the solution does work.
However, people can vote however they wish, and the upvotes more than negate the downs. Add a comment. This is simple text email message. Taken from here. Basith Basith 1, 7 7 silver badges 22 22 bronze badges. Ask Question Share Tweet. Download Source Code View Demo. Mehul Said Usman Mustafa Khawar Said October 4, at AM.
Emanuele Said Nice code…. Thx September 24, at AM. Hans Rondon Said Ivan Said How can I adapt to send multiple files? November 25, at AM. Umesh Computer Said August 19, at AM. Christoph Said Nice nice! Thank you! January 28, at PM. Sukhdeep Kaur Said
0コメント