How to Share a PDF on WordPress with Email?
Upload the PDF, share its link, or send it from a form or wp_mail() using the file path, not the URL. Size limits, spam and protected downloads explained.

The simplest way to share a PDF from WordPress by email is to upload it to the Media Library, copy its file URL, and paste that link into your email. If you want the site to send the PDF for you, for example after someone fills in a form, attach the file to the form’s confirmation email or send it with WordPress’s wp_mail() function, using the file’s path on the server, never its URL. For anything over a few megabytes, send a link instead of an attachment.
That covers most cases. This guide walks through each method step by step, plus the limits that decide which one works: upload size, email attachment size and spam filtering. Our team checked every menu label, block setting and function against the WordPress 7.1 source and Contact Form 7 6.2.5 on 18 November 2026, and tested how WordPress’s bundled PHPMailer 7.1.1 handles attachments.
This page has no Search Console queries recorded yet, so the headings follow the questions site owners ask when they first try this.
What is the quickest way to share a PDF from WordPress by email?
Upload the PDF once, then send people a link to it. Links keep emails small, never bounce because of attachment size, and let you replace the file later without resending anything.
- In the dashboard, go to Media > Add Media File (the label in WordPress 7.1).
- Drag your PDF onto the upload area, or click Select Files.
- When the upload finishes, open the file in Media > Library.
- In the attachment details panel, click Copy URL to clipboard.
- Paste that link into your email, newsletter or message.
The link looks like https://example.com/wp-content/uploads/2026/11/price-list.pdf. Anyone who has it can open the file, which is fine for brochures and guides, and a problem for anything private. We cover protected downloads further down.
Need to replace the PDF later without changing the link? WordPress core cannot overwrite a media file in place; uploading again creates a new file with a new name such as price-list-1.pdf. Either update the link everywhere, or use a plugin that replaces media files while keeping the URL.
How do I upload a PDF to WordPress?
PDF is an allowed upload type in WordPress by default, so the steps above work on any standard install. The only thing that usually stops an upload is size.
Look under the upload area on Media > Add Media File. WordPress prints Maximum upload file size there. That number comes from your server, not from WordPress: core’s wp_max_upload_size() takes the smaller of PHP’s upload_max_filesize and post_max_size settings. On a Multisite network there is a second limit, Max upload file size under Network Settings, which defaults to 1,500 KB on a new network.
If a big PDF fails with a size error or a generic HTTP error, raise the PHP limits through your host’s control panel or php.ini, and compress the PDF before trying again. Our guide to the WordPress HTTP error on media upload walks through every cause of failed uploads, not just size.
Limit | Where it is set | Typical fix |
|---|---|---|
PHP | php.ini or host panel | Raise it, along with |
PHP | php.ini or host panel | Keep it equal to or larger than the upload limit |
Multisite upload limit | Network Admin > Settings | Raise “Max upload file size” (in KB) |
Web server body size (for example Nginx | Server config | Ask your host if uploads fail with a 413 error |
How do I add a PDF to a WordPress page so visitors can view it?
Use the core File block. It inserts a link to the PDF, a download button and, for PDFs, an inline preview.
- Edit the post or page and click the + block inserter.
- Search for File and insert the block.
- Click Media Library to pick a PDF you already uploaded, or Upload to add a new one.
- In the block sidebar, under PDF settings, choose whether to Show inline embed and set the Height in pixels (600 by default).
- Under Settings, choose what the file name links to (the Media file or the Attachment page), whether it opens in a new tab, and whether to Show download button.
Two details from the WordPress 7.1 source are worth knowing. First, when you pick a PDF, the inline embed is switched on by default. Second, the preview is an HTML <object> that the front end hides whenever the browser cannot show PDFs inline. The check uses navigator.pdfViewerEnabled where available and treats most phones, Android tablets and iPads as unable to preview. On those devices visitors see only the link and the download button, which is the right fallback, but it surprises people who tested on a laptop.
Then, once the page is live, the email part is easy: send people the page link rather than the file link. The page can explain what the PDF is, offer related reading, and you can update both later.
Do I need a PDF viewer plugin?
Only if you need things the File block does not do: a consistent viewer on phones, page navigation and zoom controls, a flipbook look, or download blocking. PDF Embedder, for example, has more than 300,000 active installs on WordPress.org and draws PDFs with its own JavaScript viewer instead of the browser’s. We compared five options in our roundup of WordPress PDF viewer plugins, including what “prevent download” really means for each.
How do I email a PDF automatically when someone fills in a form?
This is the classic lead magnet setup: a visitor enters their email address and the site sends them the PDF. Most form plugins can do it. Here is the exact setup in Contact Form 7, the most installed form plugin on WordPress.org with more than 10 million active installs, version 6.2.5 at the time of writing.
- Upload the PDF to the Media Library and note where it landed, for example
wp-content/uploads/2026/11/guide.pdf. - Edit your form and open the Mail tab.
- Tick Use Mail (2). Mail (2) is a second, separate email, normally used as an autoresponder to the visitor.
- In Mail (2), set To to the visitor’s email field, for example
[your-email]. - In the Mail (2) File attachments box, enter the path to the PDF relative to the
wp-contentfolder:uploads/2026/11/guide.pdf. - Save, then submit the form yourself with a real address and check the attachment arrives.
The path rule is where most people get stuck. We read the Contact Form 7 6.2.5 code: it joins whatever you type to WP_CONTENT_DIR, then refuses any file that does not resolve to a readable file inside wp-content (or a custom UPLOADS or WP_TEMP_DIR folder). A full URL, or a file outside those folders, is silently skipped and only a PHP notice records why. The email still sends, without the PDF.
Other form plugins have their own way of doing this, and some only attach files a visitor uploaded, not a fixed file of yours. Check your form plugin’s documentation, and if it cannot attach a static file, put the download link in the confirmation email instead. A link is often the better choice anyway, for the size and spam reasons below.
How do I send a PDF attachment with wp_mail()?
If you are writing your own code, WordPress’s wp_mail() takes attachments as its fifth argument. In WordPress 7.1 the full signature is wp_mail( $to, $subject, $message, $headers, $attachments, $embeds ), and the docblock describes $attachments as “Paths to files to attach”. Paths, not URLs.
Checked on 18 November 2026 against WordPress 7.1 (PHP 8.1 and newer). Add it to a small custom plugin or a code snippets plugin, not to a parent theme’s functions.php:
/**
* Email a PDF from the Media Library to one address.
* Attaches files up to 10 MB; larger files are sent as a download link instead.
*/
function twp_email_pdf( $to, $attachment_id ) {
$path = get_attached_file( $attachment_id ); // Server path. wp_mail() cannot attach a URL.
if ( ! is_email( $to ) || ! $path || ! is_readable( $path ) ) {
return false;
}
$subject = sprintf( 'Your PDF from %s', get_bloginfo( 'name' ) );
$headers = array( 'Content-Type: text/plain; charset=UTF-8' );
if ( filesize( $path ) > 10 * MB_IN_BYTES ) {
$message = "Hi,\n\nYour PDF is ready to download here:\n" . wp_get_attachment_url( $attachment_id ) . "\n";
return wp_mail( $to, $subject, $message, $headers );
}
$message = "Hi,\n\nThe PDF you asked for is attached to this email.\n";
// A string key sets the file name the reader sees.
return wp_mail( $to, $subject, $message, $headers, array( 'your-guide.pdf' => $path ) );
}
// Log every send that fails, with the reason.
add_action(
'wp_mail_failed',
function ( $error ) {
error_log( 'wp_mail failed: ' . $error->get_error_message() );
}
);Call it from your own code, for example twp_email_pdf( 'reader@example.com', 123 ); where 123 is the attachment ID shown in the Media Library URL. A few things in that snippet are deliberate:
get_attached_file()returns the file’s path on the server. That is whatwp_mail()needs.- The string key
'your-guide.pdf'sets the file name the reader sees. In the 7.1 source,wp_mail()passes a string array key to PHPMailer as the attachment name. - The 10 MB switch sends a link instead of an attachment for large files.
MB_IN_BYTESis a WordPress core constant. - The
wp_mail_failedhook writes every failed send to your PHP error log.
Why does wp_mail() send the email but drop the PDF?
Because a bad attachment does not fail the email. We tested WordPress 7.1’s bundled PHPMailer 7.1.1 directly: passing a URL, or a path to a file that does not exist, throws “Could not access file”. Inside wp_mail(), that exception is caught and the loop simply continues to the next attachment. The message still goes out, wp_mail() still returns true, and wp_mail_failed never fires for it.
So if PDFs go missing, check the path first. Log get_attached_file() and confirm is_readable() on it before you call wp_mail(), as the snippet does.
How big can a PDF email attachment be?
Smaller than you think. Google’s Gmail help page sets a 25 MB limit for personal Gmail accounts, and when attachments go over it, Gmail swaps the file for a Google Drive link. Work and school accounts use whatever limit their administrator sets. Microsoft 365 limits depend on the admin settings too.
Then there is encoding. Email sends attachments as Base64 text, which makes them roughly a third bigger on the wire. A 20 MB PDF becomes about 27 MB in transit and can be refused by servers with a 25 MB cap. Your own sending service may have a lower limit than the recipient’s inbox, so check its documentation too.
PDF size | What we recommend |
|---|---|
Under 2 MB | Attach it, or link it. Either is fine. |
2 MB to 10 MB | Attach only if the reader expects it; a link is safer. |
Over 10 MB | Always send a link to the file or to a page that hosts it. |
Contains personal data | Send a link to a protected download, never a plain attachment. |
Compress PDFs before you upload them. Scanned documents and print-ready brochures are often ten times bigger than they need to be for screen reading.
Why do emails with PDFs from WordPress land in spam?
Usually not because of the PDF. WordPress sends mail with PHP’s mail() function by default, through your web server, and that mail often lacks the SPF, DKIM and DMARC alignment that Gmail, Yahoo and Microsoft now expect from bulk senders. An attachment just raises the stakes, since spam filters scan attachments more strictly than plain text.
Fix the sending route first. Connect WordPress to a real email service over SMTP or an API with a plugin such as WP Mail SMTP (more than 4 million active installs on WordPress.org), and set up the DNS records your provider gives you. Our WordPress email deliverability guide covers the full setup, and if you use SendGrid, our walkthrough on setting up SMTP for SendGrid shows each screen.
After that, keep the email itself plain: a clear subject, a few lines of text, one PDF or one link. Emails that are nothing but an attachment, or that carry several large files, score worse with filters.
How do I send a PDF to my whole email list?
Through your newsletter tool, and as a link. Most bulk email services do not let you attach files to campaigns at all. Mailchimp, for example, has you upload the file to its own hosting and insert a link; its help page on sharing files with contacts explains that attachments can slow or stop bulk delivery or get blocked by security software, and the campaign report then shows how many contacts opened the file.
You have two choices for where the PDF lives:
- Host it in the newsletter tool. Quick, and you get click counts per contact. The file sits outside your site, though, so readers never land on your pages.
- Host it on your WordPress site and link to the page that holds it. Readers arrive on your site, you can update the PDF in one place, and the page can carry a short summary for people who will not open a PDF on their phone.
For a monthly newsletter or a price list that changes, our team prefers the second option: one page, one URL that never changes, and a new PDF swapped in behind it each month.
How do I see who downloaded the PDF?
It depends on how you sent it. Attachments give you no data at all once the email leaves your server. Links do.
- Google Analytics 4 logs a
file_downloadevent automatically when enhanced measurement is on. Google’s enhanced measurement documentation listspdfamong the extensions that trigger it and records the file name, extension and link URL. You see counts, not names. - Your newsletter tool reports clicks per subscriber, so you know which contacts opened the link.
- A download manager plugin such as Download Monitor keeps its own download log on your site.
- UTM tags on the link in each email (for example
?utm_source=newsletter&utm_medium=email) show which mailing sent the visit when people land on the page that hosts the PDF.
If you need to know exactly which person downloaded a file, for compliance or for sales follow-up, you need a gated download: a form or login in front of the file, as described next.
How do I protect a PDF so only the right people can download it?
Start with the uncomfortable fact: files in wp-content/uploads are served directly by the web server. Making a post private, or putting the File block on a members-only page, does not protect the PDF itself. Anyone with the direct link can download it, and links in emails get forwarded.
Your options, from simplest to strongest:
- Accept that it is public. Fine for brochures, menus, price lists and lead magnets.
- Use a download manager plugin. Download Monitor (more than 80,000 active installs, updated 17 November 2026) serves files through its own download links and can limit them to logged-in users, with download counts as a bonus.
- Sell or gate it as a product. Easy Digital Downloads sends buyers download links that expire; the default expiry in its code is 24 hours, adjustable in its settings.
- Store files outside the web root and stream them through PHP after a capability check. This is the strongest option and needs a developer.
If members upload PDFs themselves, for example in a community or directory, treat those uploads as untrusted. Our guide to hardening member uploads covers file type checks, storage location and server rules.
Common mistakes people report
These come up again and again in WordPress.org support threads and the Gutenberg issue tracker. Checked on 18 November 2026.
- “The form email arrives, but the PDF does not.” A long-running pattern in Contact Form 7 threads, such as this one about attached files not arriving and another about documents not attaching. In current versions the usual cause is a path that is not relative to
wp-content, or a full URL in the File attachments box. - The attachment reaches the autoresponder but not the main email. Reported in this Contact Form 7 thread. Mail and Mail (2) each have their own File attachments box, so a file added to one is not added to the other.
- The PDF preview shows on desktop but not on phones. Long tracked in Gutenberg as issue #46382 (opened December 2022, closed August 2026). The current File block hides the inline embed on devices that cannot render PDFs, so mobile visitors see the link and download button only.
- Every PDF gets embedded whether you want it or not. The inline embed switches on by default for PDFs, and the request to change that default, Gutenberg #34825, is still open. Turn off Show inline embed on each File block where you only want a link.
- The preview did not appear on older classic themes. Reported in Gutenberg #57419 in December 2023 and closed the next day. If you still see it on an old site, update WordPress and the theme first.
- “The uploaded file exceeds the upload_max_filesize directive in php.ini.” The most common upload error for large PDFs, as in this old but typical thread about PDF uploads, and it still appears in support forums every week. It is a PHP setting on your server, not a WordPress option.
Which method should you use?
Situation | Best method |
|---|---|
Send one PDF to a few people | Upload, copy the file URL, paste it into your email |
Give readers a PDF on a page | File block, and email the page link |
Lead magnet: PDF after a form | Form plugin confirmation email with the file attached or linked |
Your own plugin or theme code |
|
Large files (10 MB and up) | A link, never an attachment |
Private or paid documents | Download manager, membership plugin or expiring links |
FAQ
Can WordPress send a PDF by email without a plugin?
Yes, with code. wp_mail() is part of core and can attach any file on the server. For a no-code setup, you need a form plugin or a newsletter tool.
Why does my PDF link show a 404 after I re-uploaded the file?
WordPress gave the new upload a new file name, and you may have deleted the old file. Update the link to the new URL, or restore the old file.
Can I attach a PDF to WooCommerce order emails?
Not from the WooCommerce settings screens. The woocommerce_email_attachments filter lets a developer add files to specific order emails, or you can use an extension built for it.
Does the File block work in the classic editor?
No. In the classic editor, use Add Media to insert a link to the PDF instead. The link works the same way, without the inline preview.
Is it safe to put PDFs in the Media Library?
PDF uploads are allowed by default and are generally safe to host. Do not upload anything you would not want public, since the file URL is not protected by page privacy settings.
Plugins we build and run
We maintain these ourselves, which is why we can support them on your site.
- BuddyNextThe self-hosted community engine for WordPress
- BuddyXFree community theme, Pro when you outgrow it
- ReignPremium community theme. Add pieces, build anything
- JetonomyCommunity forum and Q&A for WordPress
- EventonomyEvents and RSVPs for WordPress communities
- LearnomyCourses and learning communities on WordPress
- ListoraDirectories and listings your members can browse
- SnipShareCode sharing built for developer communities
- WB Ad ManagerAd placements that turn traffic into revenue
- WP Career BoardA job board your community actually uses
- WP Sell ServicesSell services with offers, orders, and payouts
- MediaVersePhotos, video, and media albums for members
- WB GamificationPoints, badges, and rewards that keep members active
- Product RoadmapPublic roadmaps with voting your users trust


