Processing Answers to emails sent by the system - mailgun

I'm building a ticketsystem which creates tickets from incoming email automatically. The workflow look's like this:
User send's a email to support#yourname.xyz
The System creates a new ticket
A Team member answers to the ticket via a Dashboard
The User get a notification with the answer per email
Now I wan't to give the user the option to answer the ticket by reply to the email from step 4. But how can I assing the reply to a ticket?
Sometimes I saw solutions where the ticket id is stored in the header. The subject looks then like [#12345] Your Request But is there a better way to store the ticket id so the user can't see it? When I set a header variable on the email sent in Step 4, the varibale won't be included in the reply from the user.
Dose anyone have a soulution for this problem?

instead of prefixing the ticket ID to the 'Subject' field, create a new field in your out-bound mail. Just as you create a 'SendTo' field, also create a 'TicketID' field. This makes the value hidden unless the recipient looks in the mail's headers.
this will then also make it easier to search for replies by the ticket number.
I think I've understood your question, but if not, please clarify.

Related

Which OTRS actions send outgoing mail?

Is there a list which ticket actions send an email [to the customer]? For "note internal/external" it's quite obvious, but nothing tells me if "Phone Call Inbound/Outbound" notify anyone.
Is this documented somewhere? Is it possible to configure an indication at each actionwhether it's going to send something out?
No there is not.
Only if you create a new article type that is "email" it will get send. By default you can create a new "email ticket" and you can select an e-mail outbound or reply to an e-mail message.
by default only email-external, email-internal, email-notification-ext, email-notification-int get send. All other Times can only be seem from inside OTRS.

How to design email and username login

I have two question about usernames and emails
1. I judge username is a Email if '#' in username, and auth it follow:
email_user = User.objects.get(email__iexact=username)
authenticate(username=email_user.username)
Is that a good way that you recommended? or you may have a better advice?
I know a AbstractBaseUser can do it, but I think use User is more reasonable.
2. Should I store the user's email within the User.email field?
Imagine if I sign up a new user with:
username: '123'
email: '456#google.com'
and when I signup success, then I find that my email is wrong,
and now another user that email is '456#google.com' can't signup again.
I just want to a email is verified that can associate with the user.
what's your advice?
If you want to use email as your unique sign in key, it would save you a lot of trouble in future development of your website if you make a custom User model using AbstractBaseUser. If you want i can post a sample working code
In reference to your second question - You can use Cryptographic signing in Django (https://docs.djangoproject.com/ja/1.9/topics/signing/) to produce a key. Further send this key as a link (eg www.example.com/verify/:some_crypto_key:) and send it as a link to user's email address. This key will contain user id and time stamp. If you receive a request on that link, it means that email is legit. You may find a package that does a similar task maybe.
EDIT:
Implementation (short way) - As the user signups on your website, Immediately ask him/her to verify account using the link you have sent to the given email. If you do not receive a response from that email within a given time (say 20 mins), delete that user entry. This means that you can not let the user access your website until he/she verifies the account.
Flaw - Consider a situation where the user has submitted a wrong email. It is obvious that the user will never be able to verify it but for those 20 mins if co-incidentally the actual user with that same email tries to signup on your website, he won't be able to access. This is very unlikely. Also this user will receive an email from your website saying that user has signed-up on a website (so here you can provide another link, 'if this was not you, please click here' kind of thing)
Unless you have a burning desire to write your own custom user model, which will let you replace the username field with the email, I would recommend using something like Django AllAuth. It includes email verification (as outlined in your question), and can be set to use email as username fairly easily. It's a well established library with lots of support, and will be more immediately usable than rolling your own.
(That said - rolling your own is an illuminating experience, and RA123's point is the answer you should accept if you're going down that road.)

Receiving emails with sendgrid and cloudmailin

I have the same concept as mentioned in this question(generating a unique random email address for each user in rails app. When the user sends an email that that randomly generated email address, we process the body and store in db.
I followed the following steps:
Deployed my app in Heroku
Created a sendgrid account and configured the username and password to heroku(to get the sendgrid addon).
added griddler gem and followed the steps mentioned in griddler.
Configured the parse webhook in sendgrid with my host and url.
Here comes the main problem:
I registered to coludmailin and it generated the single email address. I don't really understand how to receive uniq emails to my rails application now. I tried white labeling the cloudmailin.net in sendgrid but it doesn't work(may be am wrong here).
Googled a lot but didn't understand how to proceed from here. Can someone please help me in solving this issue. Appreciate if I get a good step-by-step reference
There are two options to do this with CloudMailin.
Option 1:
On the free plan you can use a + in order to separate the email address given to you on CloudMailin and still create a unique email address that each customer can respond to. For example:
If you CloudMailin email address is example1234#cloudmailin.net you can use example1234+unique_id_54321#cloudmailin.net. CloudMailin calls unique_id_54321 the disposable part of this email address. This way you can send an email out and state the sender of that email is example1234+unique_id_54321#cloudmailin.net and then tell one user from another.
Option 2 (the better option):
However, the best way to do this is to use CloudMailin's custom domains. You can then receive anything#yourdomain.com.
With custom domains enabled you set CloudMailin up to be your MX server. Then any email coming into yourdomain.com goes direct to CloudMailin (you can use app.yourdomain.com to avoid conflicts with your regular email if needed).
You can then send email out with the sender as user-12345#yourdomain.com, task-12345#yourdomain.com or any other unique identifier. When you receive the email from CloudMailin the envelope will show that the email was sent to user-12345#yourdomain.com and you can then use this to resolve who the user was.

how to get a users #facebook.com email?

I am trying to find out if a user has an #facebook.com email for messaging but can not see where to request that I do request perms for their regular email and can get that, but can't see where to get their #facebook.com email. It's not included in https://graph.facebook.com/me/ and since there's no guarantee that they have set one up I can't assume that it's based on their username
If a user has a facebook.com email address it will be their {username}#facebook.com. However, just because a user has a username setup, doesn't mean there's a corresponding email for it. I've had a username since Facebook landrushed them, and just the other day I setup an email for it. There's no way to tell if they've set it up. Your best bet is to ask the user for an email address that your app can use.
Just go to your privacy settings and from there act as you are editing you email address then there is a Facebook email button setup there.

OTRS 3.0: Agent notes by email - notifications

My goal is that agents can attach notes to a ticket by email.
I have set up a second mail address ticketnotes#... which is filtered by a PostMaster Filter. In this way I can set the X-OTRS-[FollowUp-]ArticleType header to note-internal and X-OTRS-[FollowUp-]SenderType to agent and the email gets attached as agent note to the ticket mentioned in the subject. That works quite well. The problem is that the subsequent notifications emails are of the type Agent::FollowUp and not Agent::AddNote. That is confusing my agents.
Can someone tell me what I'm missing here?
Followups are when a user mails an email. You will want to set the header. Set this field: X-OTRS-FollowUp-ArticleType
see the code:
ArticleType => $GetParam{'X-OTRS-FollowUp-ArticleType'},
http://tesisitil.googlecode.com/svn/trunk/trunk/otrs-2.4.5/Kernel/System/PostMaster/FollowUp.pm
see also: http://forums.otterhub.org/viewtopic.php?f=61&t=4966