Solved

Email with no subject or body text

Posted on 2014-12-22
11
105 Views
Last Modified: 2015-01-04
I have a need to generate an email on a web server using php that has no subject line or message body text but has an attachment.

This is to send an email directly to an HP printer using an HP service; doing it in this way will allow the email attachment to be directly printed.

I have been using SendGrid; it does everything fine EXCEPT it requires a subject & email text, which still works but prints an extra page on the printer with the text message.

Does someone know of an alternate way that will NOT require a subject or body?

Thanks
0
Comment
Question by:Richard Korts
  • 6
  • 3
  • 2
11 Comments
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40513276
I don't know SendGrid, but AFAIK with PHPMailer and the mail() function itself you can just set subject and body to empty strings.
0
 

Author Comment

by:Richard Korts
ID: 40513282
What is AFAIK?

I know I used phpMailer in the past; there were issues, I can't remember the details.

Thanks
0
 

Author Comment

by:Richard Korts
ID: 40513289
Never mind, I found out it's an internet acronym.
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40513358
I didn't replay because I was away. PHpMailer issues? No software is perfect, but PHpMailer is for sur one of the bet choices to send email via php... I can't figure out what it could be the problem... Anyway, good luck with your project.
Cheers
0
 
LVL 82

Expert Comment

by:hielo
ID: 40513378
>> which still works but prints an extra page on the printer with the text message.
If the issue with that extra page is that it contains the text message, have you tried setting the subject and body to a space character (ASCII 32) so that you only get a blank page.

Alternatively, the following may help you:
http://www.finalwebsites.com/forums/topic/php-e-mail-attachment-script
0
 

Author Comment

by:Richard Korts
ID: 40513396
To Marco Gasi,

I'm setting up to try it now.

Customer office (where printer is) is closed until Jan. 6, so I won't know till then.

Thanks
0
 
LVL 31

Expert Comment

by:Marco Gasi
ID: 40513419
Well, we'll wait until 7 january. Merry Christmas and Happy New year. :-)
0
 

Author Comment

by:Richard Korts
ID: 40513421
To hielo,

They don't want a blank page, that is part of the issue.

Plus, with SendGrid, they don't allow what you suggested; I asked them that specifically last week.
0
 

Author Comment

by:Richard Korts
ID: 40522195
To Marco Gasi,

I set up a test with a blank message body; test code attached.

I get this:

entered test mail
bottom of test mail
Mailer Error: Message body empty

So I deduce that phpmailer cannot send with a blank body.

Any one else with ideas?

Thanks.
phpmailer-ex1.php
0
 
LVL 82

Accepted Solution

by:
hielo earned 500 total points
ID: 40522426
>>Any one else with ideas?
Did you try the using mail() as in the link I posted above?
0
 

Author Closing Comment

by:Richard Korts
ID: 40530480
That seems to work!

Thanks.
0

Featured Post

VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Move wordpress site 3 40
How would I do a website like this? 5 59
Loop through multiple arrays 13 29
PHP strings vs array errors 13 19
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question