I use PHPMailer to send email to a hp printer (ENVY 5644) which will print whatever the body contain and any attachments. This works, however, I would like to send it body-less since only the pdf attachment is of any interest. The body is just waste of paper. I know it is suggested in other treads that one could just put a single space character in the body and it will look empty but the printer will spit out an empty paper anyway. If I send an email from Thunderbird where I write nothing inside the body, not even a single space but only add an attachment, I do not wast any paper when printing. Only the attachment is printed.
I know, I can just put the paper back into the tray but it would be more nifty if I did not have to.
Any solution?
It looks like your looking for the flag $mail->AllowEmpty = true; - just check the source code
Related
I know how to use python3's email.mime.multipart.MIMEMultipart class to create various kinds of multipart email messages.
I have a need to do "email surgery" on certain existing multipart messages by taking the body (which contains the various MIME parts) and to remove and add some new parts without changing the rest of the email's headers. In the headers, there is the following sample header:
Content-Type: multipart/mixed;
boundary="ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ"
... where the ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ boundary is used to separate the existing message parts.
I want to use the email.mime.multipart.MIMEMultipart tools to create a new body with modified parts, and I want to use the same ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ boundary between these parts, so that I don't have to go back and change the Content-Type header that already exists among the message's original headers.
It would be ideal if I could specify the exact text of the boundary that I want to use when creating this multipart body, but in python3, it seems like the email.mime.multipart.MIMEMultipart package always creates its own, randomly generated boundary string.
In python3, is there any way to tell the email.mime.multipart.MIMEMultipart software to use a boundary string that I supply?
If not, I can work around this by taking the newly generated message body, extracting its new boundary string (which I'll call "newboundary", and then replacing it with the original boundary (which I'll call "originalboundary"), as follows:
msgbodytext = msgbodytext.replace(newboundary, originalboundary)
But I prefer not to do this, if possible.
Any ideas about how to tell email.mime.multipart.MIMEMultipart to use a boundary string that I specify? Thank you.
I originally misread the docs, and now that I re-read them, I see that this is trivially easy.
To set my own boundary to the value of the originalboundary variable, I just have to do this:
msg = email.mime.multipart.MIMEMultipart(boundary=originalboundary)
Telegram bot sends me a message with a text snippet, which I want to edit, and send back to the bot for further processing.
Copy and paste takes time. Typing message anew takes time.
Ideally I'd like to press an inline button "Edit" on the bot's message and get the message text appear in my reply input box for editing.(A message id attached to my reply somehow would be a plus).
I tried to use deep linking with parameters other than /start*, but that doesn't seem to work.
Can I use bot API (or any other telegram API) to have text ready for editing in my input box?
It's impossible in official apps yet. Your question is about working with drafts - there are no methods in both API to create them or clear.
Nevertheless, you could fork any official app stored on GiHub and implement what you need if you would prefer a hard way, but compared to that copy/past solution seems much more easier, isn't it?
UPD
I can offer to you a new idea how to solve your problem - hope it will be helpful.
This is about switch_inline_query_current_chat field of InlineKeyboardButton. Just attach an inline button to messages you need to edit. Set a text for this field gotten from recieved message and after pressing you will get this text to your input area. All seems good, but you will take bot's username before the text also.
I'm sending HTML mails through PHPMailer to my Gmail account (Inbox app), but I cannot build a body which wouldn't get quoted
(you get new e-mail and all there is is "..." which you click and rest of the mail shows, it's for hiding previous conversation if you Reply).
I have tried including tags, but as soon as I add <br> or <p>, it all gets quoted.
Best I could make work was
$message = "<html><body><p>Lalalala</p> trololo </body></html>"
which resulted in Lalalaa "...", if I add paragraph around trololo, all I get is "..."
Anybody came accross this?
After very deterministic experience (one mails sent 2x got quoted differently each time), the thing that helped was wrapping the entire mail in <span> tags.
After reading this question I ran the script:
How can I download all emails with attachments from Gmail?.
For some reason, not all my labels or messages with attachments are downloading. I think it's either there is a problem with identifying the labels or that I have seven gmail accounts that I sent out. For example my main one is example1#gmail.com but I can send mail as example_2#gmail.com from example1#gmail.com
I did find gmailbackup (another python module) and have it running currently. The problem is that it doesn't download attachments that I've been able to find in the documentation and in the program. I am trying to jerry rig these two source codes together, but I am having problems in reading and understanding the script of gmailbackup.
So the problem was with the m.select() function. The m.list() function does not make a list for you to query for each label.
So I added these lines:
m.list()
inboxes = list(m.list())
for item in inboxes[1]:
mailbox = item.split('"')[3]
m.select(mailbox) # here you a can choose a mail box like INBOX instead
There are probably better and more efficient ways of doing this, however I was in a hurry. Using re and matches module would probably be great to build in.
Edit:
There is a second way of applying a filter that adds the label attached to anything attached and downloading from that label.
Edit 2
Gmail has a limit to downloads per day, so if you are dealing with large emails you might want to track what you have already downloaded.
I know you can send email using https://mail.google.com/mail/?view=cm&tf=0&fs=1&to=email#address.com&body=text
However, my body is normally over the size limit (about 800 chars) it can handle. How can I specify the body otherwise? Is there a way to attach a file?
Also, can someone explain the key words used in this approach? What does tf=0 mean? and fs=1?
Also, after the email is sent out, it always pops up a dialog with "The webpage you are viewing is trying to close the window. Do you want to close this Window?" and I had to click yes or no. How can I get rid of this dialog?