I'm struggling to find documentation that gives a clear example of how to enter a message in the rmail application.
I need to specify who the email is from, the subject of the email, and then follow that with some content. It's for a small school assignment where we are relaying "status updates" from imaginary machines on an imaginary factory floor.
This is the closest I've found, but it is not very clear: http://www.s-gms.ms.edus.si/cgi-bin/man-cgi?rmail+1
Can anyone give me an example of how I would send a message that looked like this? (obviously not including the comments...)
/* header stuff */
From: something#something.com
Subject: Status update for machine 5
/* message content */
Machine ID: 7
Status Reported: Machine going offline (status 6)
Status effective: 2012-06-02 12:30:23
I am opening rmail via software controlled pipe in my application without problems, I'm just not sure how to format the data I am feeding to it since I can't find any examples online.
Thanks!
You are probably interested in using /usr/bin/mail on most modern Unixes, not rmail.
You should read the man page, but generally, it would be sufficient to use the "-s" flag to set the subject of the mail, and input the content of the message on stdin. There is no need to set the From: line, as the system will do that for you (and in the general case, the system will not let you specify arbitrary from addresses to prevent forgeries.)
Related
When adding 'List-Unsubscribe' email headers, what kind of handling is required on the server-side for the callbacks?
It's possible to add both a mailto-link and a web-link to the header, in PHPMailer it could look like this:
$email->AddCustomHeader("List-Unsubscribe: <mailto:unsubscribe#example.com?subject=Unsubscribe>, <http://example.com/unsubscribe.php?unsubscribeid=$id>");
But does the mailto-address have to somehow automatically handle the unsubscription, or is it okay if the request just goes to an inbox that is frequently checked by a list administrator who manually processes the unsubscribe-requests?
And what about the web-link? Does it have to point to a script that will unsubscribe the recipient there and then, or can it just point to the webpage with an unsubscribe form?
You can handle this how you like, however, you should also be aware of the List-Unsubscribe-Post header (defined in RFC8058) too, as it makes you far less prone to accidental unsubscribes caused by mail scanners.
I'd really recommend processing these automatically. It's not that difficult. The URLs in list-unsubscribe should be entirely self-contained, that is, you should embed all the data you need (for example a hash of a unique user identifier, and a mailing list ID) into the URLs, so for HTTP you might use:
'<https://www.example.com/listunsub/' . $userid .'/' . $listid . '>'
You could configure a rewrite in your web server to map that URL pattern to appropriate vars in your PHP script and do the necessary database operations to remove them from the mailing list.
For email it's a bit different:
'<mailto:listunsub-' . userid . '-' . $listid . '#example.com .'>'
For this last format you would configure your mail server to spot the 'listunsub-' prefix and use that to pipe the message into a script which could extract the user and list IDs. Notice that you don't need a subject or a message body - the address itself contains all you need, and that means that a receiver doesn't have to write a message - their mail client can simply send an empty message to the address and you will have enough info to work with.
I am using poplib in Python 3.3 to fetch emails from a gmail account and everything is working well, except that the mails are not marked as read after retrieving them with the retr() method, despite the fact that the documentation says "Retrieve whole message number which, and set its seen flag."
Here is the code:
pop = poplib.POP3_SSL("pop.gmail.com", "995")
pop.user("recent:mymail#gmail.com")
pop.pass_("mypassword")
numMessages = len(pop.list()[1])
for i in range(numMessages):
for j in pop.retr(i+1)[1]:
print(j)
pop.quit()
Am I doing something wrong or does the documentation lie? (or, did I just misinterpret it?)
The POP protocol has no concept of "read" or "unread" messages; the LIST command simply shows all existing messages. You may want to use another protocol, like IMAP, if the server supports it.
You could delete messages after successful retrieval, using the DELE command. Only after a successful QUIT command will the server actually delete them.
I'm accessing GMail via IMAP using OAuth2 authentication and Zend_Mail_Protocol_Imap.
It all works great.
What I need to do is present emails in thread form just like the GMail interface. Google make this really easy because they have an X-GM-THRID header that links a conversation with a 64-bit unsigned integer.
My problem is: when presented with a single email, how do I find out what X-GM-THRID it belongs to?
First off Google says that there is a server extension X-GM-EXT-1 which is active. You can check it is there using the CAPABILITY command (and I have).
All the information suggests that if this is active then the X-GM-THRID will simply be returned as a header, but it isn't.
Perhaps I need to ask Google to return it via the fetch command. Google does describe a simple fetch process here:
https://developers.google.com/google-apps/gmail/imap_extensions
My code is sending TAG5 FETCH 3673 (FLAGS RFC822.HEADER X-GM-THRID) but the headers do not include an entry for X-GM-THRID.
I've even simplified it to TAG6 FETCH 3673 (X-GM-THRID) to be exactly as described in the google example. In this case no headers are returned.
I'm not massively familiar with IMAP commands and I'm not sure if Zend_Mail_Protocol_Imap is abstracting some handling which means this header is being removed.
But I do know that this is driving me mad.
Am I missing something? Is it not a header?
Okay, so it looks like it is not a header. It is an attribute in the IMAP command and response.
The standard fetch command sent by Zend_Mail_Protocol_Imap is "TAG5 FETCH 3673 (FLAGS RFC822.HEADER)"
The code that handles the response only expects to be dealing with 'FLAGS' and 'RFC822.HEADER'. It passes this information to a Zend_Mail_Message object which extends Zend_Mail_Part.
Zend_Mail_Part parses information about flag. It also parses the header.
The additional 'X-GM-THRID' attribute that I added does actually get a response. but since it is not passed back to Zend_Mail_Message there is no way for me to use it. It gets lost in the ether (at around line 171 of Zend_Mail_Storage_Imap in my Zend Library to be exact).
So I've hacked the core... Zend_Mail_Storage_Imap::getMessage now expects $data['X-GM-THRID'] and passes it to the constructor Zend_Mail_Part. And I now have a method Zend_Mail_Part::getXGmThrid which solves all my problems. I'll obviously refactor them into my own classes extending Zend_Mail_Storage_Imap and Zend_Mail_Part in the not too distant... but for now I know this works.
Within our organisation we use quite a few different models of telephone sets. The only thing they have in common, apart from the dialpad, is the ability to "send" hook flash. I prefer using this type of signaling for attended transfers above combinations of the usual dialpad keys to prevent the other end from receiving DTMF-tones (to prevent unwanted interactions with IVRs or bothering people on the other end).
2 questions:
How is a flash hook represented in features.conf? According to RFC2833 section 3.10 (DTMF Events) and this article (which is about a ZAP- instead of SIP-configuration, thus my doubt... see next question, also), it should be just "flash".
From my Google-quest I've learned that hook flash gets ignored by the PBX when using the SIP-protocol in Asterisk... I do get an error message when sending it: "WARNING[26159]: chan_sip.c:6487 sip_indicate: Don't know how to indicate condition 9". Is there a way to fix it/work around it?
Asterisk version: 1.8.3.2
Using "info" for dtmfmode
Tnx in advance!
In most cases you have in you adapter settings what to do with hook. IF you have, you can change that to transfer code.
Update: after code review i can say that DTMF 16 received ok and sended in 1.8.x. BUT features.c have no any action on flash(event 16)
So posible create audiohook application for asterisk to change that DTMF 16 to 2 DTMF values or invoke transfer. Will work for DTMF method SIPInfo, and such patch complexity is below-average(5-6 hours for expert)
im searching for a simple method to "ping" a sip:user#ip and get back a status like "available for call" , "busy" , "not connected" if the first two require to make his phone ring, thats ok
(optionally if necessary to call them to see the status then it was nice to include a senders number so that i can identify my server on the phone display when its checking the status or to play a short signal .wav in case someone takes up, so that they know what it was)
.....something like sipsak -x 1200 -C random#ownip -s sip:adressee#hisip -vvv...
gives me "406 Not Acceptable without Contact header"
i did not try anything else yet
i already wonder if the sending call still needs to be logged in at an isp then?
You're probably looking for the OPTIONS message. The reply to an OPTIONS does two things - first, it tells you the capabilities of the remote party and second, more importantly, the Status-Code returned is the Status-Code you would get if you'd sent an INVITE.
According to sipsak's documentation you're looking for this:
sipsak -vv -s sip:nobody#foo.bar
SIMPLE will work, but it may be overkill for what you want to do. See http://en.wikipedia.org/wiki/SIMPLE
Of course, not all SIP phones support SIMPLE.