I'm able to sync my Gmail inbox, but the sent folder does not work.
This is my .mbsyncrc
IMAPStore martinstabenfeldt-remote
Account martinstabenfeldt
MaildirStore martinstabenfeldt-local
Path ~/.mail/martinstabenfeldt/
INBOX ~/.mail/martinstabenfeldt/INBOX
Channel martinstabenfeldt
Master :martinstabenfeldt-remote:
Slave :martinstabenfeldt-local:
Patterns *
# Automatically create missing mailboxes, both locally and on the server
Create Both
# Save the synchronization state files in the relevant directory
SyncState *
Channel martinstabenfeldt-inbox
Master ":martinstabenfeldt-remote:INBOX"
Slave ":martinstabenfeldt-local:INBOX"
Channel martinstabenfeldt-sent
Master ":martinstabenfeldt-remote:[Gmail]/Sent Mail"
Slave ":martinstabenfeldt-local:sent"
This is the error I get:
$ mbsync --verbose martinstabenfeldt-sent
Logging in...
Opening master box [Gmail]/Sent Mail...
Opening slave box sent...
Error: channel martinstabenfeldt-sent: slave sent cannot be opened.
C: 1/1 B: 1/1 M: +0/0 *0/0 #0/0 S: +0/0 *0/0 #0/0
Any idea why this fails?
I've created the ~/.mail/martinstabenfeldt/sent folder. And this folder is empty.
Not the OP's case, but you can get this exact error message if you forgot the trailing slash in the Path configuration variable for the MaildirStore.
The man page does say the trailing slash is needed, but that's easy to overlook.
Try Using [Google Mail] instead of [Gmail]. It should work.
I believe there is Starred, Spam, Sent Mail, Important, Drafts, Bin and All Mail that will work with [Google Mail]/.
Here is my config file:
IMAPAccount gmail
Host imap.gmail.com
User <your email address>
Pass <your password>
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore gmail-remote
Account gmail
MaildirStore gmail-local
Path ~/mail/gmail/
Inbox ~/mail/gmail/inbox
Channel gmail-default
Master :gmail-remote:
Slave :gmail-local:
Patterns INBOX
Channel gmail-sent
Master ":gmail-remote:[Google Mail]/Sent Mail"
slave :gmail-local:sent
Channel gmail-trash
Master :gmail-remote:"[Google Mail]/Bin"
slave :gmail-local:trash
Channel gmail-archive
Master :gmail-remote:"[Google Mail]/All Mail"
slave :gmail-local:all
Channel gmail-drafts
Master :gmail-remote:"[Google Mail]/Drafts"
Slave :gmail-local:drafts
# Automatically create missing mailboxes, both locally and on the server
Create slave # Only create locally for now
SyncState *
Group gmail
Channel gmail-default
Channel gmail-trash
Channel gmail-archive
Channel gmail-sent
Channel gmail-drafts
If you still have issues you could try the following config:
IMAPAccount gmail
Host imap.gmail.com
User <your email address>
Pass <your password>
SSLType IMAPS
CertificateFile /etc/ssl/certs/ca-certificates.crt
IMAPStore gmail-remote
Account gmail
MaildirStore gmail-local
Path ~/mail/gmail/
Inbox ~/mail/gmail/inbox
Channel gmail-default
Master :gmail-remote:
Slave :gmail-local:
Patterns "[Gmail]/Sent Mail"
# Automatically create missing mailboxes, both locally and on the server
Create slave # Only create locally for now
SyncState *
Group gmail
Channel gmail-default
Once you have this run the following command:
mbsync -Dmn gmail
You should see some output:
* NAMESPACE (("" "/")) NIL NIL
4 OK Success
>>> 5 LIST "" "*"
* LIST (\HasNoChildren) "/" "Deleted Items"
* LIST (\HasNoChildren) "/" "Drafts"
* LIST (\HasNoChildren) "/" "INBOX"
* LIST (\HasNoChildren) "/" "Junk"
* LIST (\HasNoChildren) "/" "Notes"
* LIST (\HasNoChildren) "/" "Personal"
* LIST (\HasNoChildren) "/" "Receipts"
* LIST (\HasNoChildren) "/" "Sent"
* LIST (\HasNoChildren) "/" "Trash"
* LIST (\HasNoChildren) "/" "Unwanted"
* LIST (\HasNoChildren) "/" "Work"
* LIST (\HasChildren \Noselect) "/" "[Google Mail]"
* LIST (\All \HasNoChildren) "/" "[Google Mail]/All Mail"
* LIST (\HasNoChildren \Trash) "/" "[Google Mail]/Bin"
* LIST (\Drafts \HasNoChildren) "/" "[Google Mail]/Drafts"
* LIST (\HasNoChildren \Important) "/" "[Google Mail]/Important"
* LIST (\HasNoChildren \Sent) "/" "[Google Mail]/Sent Mail"
* LIST (\HasNoChildren \Junk) "/" "[Google Mail]/Spam"
* LIST (\Flagged \HasNoChildren) "/" "[Google Mail]/Starred"
5 OK Success
>>> 6 LOGOUT
* BYE LOGOUT Requested
6 OK 73 good day (Success)
From here you can see what your respective remote folder names should be.
I'm pretty sure this is caused by your quotes; instead of:
Channel martinstabenfeldt-sent
Master ":martinstabenfeldt-remote:[Gmail]/Sent Mail"
Slave ":martinstabenfeldt-local:sent"
try:
Channel martinstabenfeldt-sent
Master :martinstabenfeldt-remote:"[Gmail]/Sent Mail"
Slave :martinstabenfeldt-local:sent
Related
Using HAproxy 1.8 I am trying to create an ACL which should dynamically match a given part of the url/path to a given header.
The portal in front of the HAproxy adds header for auth users:
X-roles MQ-QUEUE(QUEUE=test.queue,QUEUE=foobar.queue)
The accessed URL looks like:
https://portal/mqsrv/some/custom/path/with/queue/test.queue/in/path
my configuration so far:
frontend main
...
acl src_portal src 192.168.5.0/24
acl url_mqsrv path_beg -i /mqsrv
# working static approach
acl perm_mq req.fhdr(X-roles) -m str MQ-QUEUE(QUEUE=test.queue) if { path -m /test.queue/ }
# how to achieve this dynamically?
#
...
use_backend backend_mqsrv if src_portal url_mqsrv perm_mq
I tried to get the part of the path via regex into a variable like:
http-request set-var(txn.requested_queue) path,reg(queue\/(\K.*)\/ \1)
That does not work, because 'reg' is an unknown converter. Other attempts were using the regex to get the queue from the path for a match against the role header but I can not find a working way how to extract the queue part from a request path to use it for the role-header match. Another idea would be to use a lua script but that would not be as performant as an acl-match I guess.
I could not find a way to do that without using a lua script, so I solved it this way:
/etc/haproxy/haproxy.cfg:
global
...
# load loa script to check MQ-QUEUE() role
lua-load /etc/haproxy/check-roles.lua
frontend main
bind hap-rip:80
capture request header X-roles len 50
http-request set-var(txn.roles) req.fhdr(X-roles)
http-request set-var(txn.request_urlpath) path
acl src_portal src 192.168.5.0/24
acl url_mqsrv path_beg -i /mqsrv
# if acl matches, use backend_mqsrv
use_backend backend_mqsrv if src_portal url_mqsrv { lua.queue_allowed(txn.roles,txn.request_urlpath) -m bool true }
# if no acl matches the request, use default backend which serves a 403 forbidden response
default_backend backend_no-match
backend backend_mqsrv
log 127.0.0.1 local2
balance leastconn
acl src_portal src 192.168.5.0/24
http-request deny unless src_portal
# remove /mqsrv/ from request url
reqrep ^([^\ :]*)\ /mqsrv/(.*) \1\ /\2
# echo -n "username:password" | base64
reqadd Authorization:\ Basic\ *********************=
server mqsrv mqsrv.domain.local:443 ssl check-ssl check verify none
backend backend_no-match
# tcp-request content reject
mode http
http-request deny deny_status 403
/etc/haproxy/check-roles.lua:
-- example url https://portal/mqsrv/some/custom/path/with/queue/test.queue/in/path
-- example role header from portal: X-roles: MQ-QUEUE(QUEUE=ABC,QUEUE=test.queue,QUEUE=XYZ)
-- notes on haproxy lua logging: https://stackoverflow.com/questions/65879666/haproxy-lua-logging
-- https://www.codegrepper.com/code-examples/lua/lua+split+string+by+delimiter
function Split(s, delimiter)
result = {};
for match in (s..delimiter):gmatch("(.-)"..delimiter) do
table.insert(result, match);
end
return result;
end
-- function to check if requested queue (from url path) is contained in roles-header (injected from portal)
-- https://www.haproxy.com/blog/5-ways-to-extend-haproxy-with-lua/
core.register_fetches("queue_allowed", function(txn, var1, var2)
-- get role and path values from request
local roles_authorized = txn:get_var(var1)
core.log(core.info, "roles header: " .. roles_authorized)
-- extract requested queue from url/path
local request_urlpath = txn:get_var(var2)
-- local requested_queue = Split(request_urlpath,"/")[10] -- get requested queue by position
local requested_queue = request_urlpath:match("queue%/(.*)%/") -- get requested queue by matching string after 'queue/'
core.log(core.info, "requested_queue: " .. requested_queue)
-- extract QUEUES from MQ-QUEUE() header
queues = Split(Split(roles_authorized,'%(')[2],'%)')[1]
core.log(core.info, "queues: " .. queues)
-- loop through comma seperated queues to check if requested queue is found
for _,item in pairs(Split(queues,',')) do
queue = Split(item,'=')[2]
core.log(core.info, "authorized queue: " .. queue)
if queue == requested_queue then
core.log(core.info, "requested queue " .. requested_queue .. " matched with authorized queue " .. queue .. " - allowing request!")
return true
end
end
end)
I am trying to set up a postfix mail server with dovecot as MDA.
According to this link to set up dovecot to use LMTP I have done the following config.
postfix
main.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
master.cf
submission inet n - y - - smtpd
-o syslog_name=postfix/submission
-o smtpd_tls_security_level=encrypt
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/bin/sudo /usr/lib/dovecot/deliver -f ${sender} -d ${user}
dovecot
dovecot.conf
protocols = imap lmtp
10-mail.conf
mail_privileged_group = mail
10-master.conf
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
mode = 0600
user = postfix
group = postfix
}
# Create inet listener only if you can't use the above UNIX socket
#inet_listener lmtp {
# Avoid making LMTP visible for the entire internet
#address =
#port =
#}
}
The mailboxes will be present in user's home directory /users/<username>
As stated by the link /users is the home directory of vmail user.
However with this config when I try to send mail like:
mail -s "subj" username
The mail bounces saying
warning: maildir access problem for UID/GID=<uid>/<gid>: create maildir file ~username/Maildir/tmp/<tmp file>: Permission denied
The ownership of ~username is vmail:vmail
However the mail is successfully sent when the ownership is changed to <user>:<group> for each user.
How can I get this thing working with the mail directory ownership kept as vmail:vmail ?
Note: I am not trying to set up SASL as of yet.
I am just tryin
You need to change ownership users and groups using below mentioned command.
example:-
chown -R user:group /path/to/file
-R --> recursive option
I get email alerts that are generated by a user on one of my servers. These alerts are generated by server#######.com and they have to do with third party software not working properly.
I'm trying to use procmail to copy (as I want to keep receiving these) these emails to ABC#XYZ.com.
I'm looking for emails that, in their body, have "C:" followed by 6 characters, a dot, and 3 more characters. All of that is working fine, but I want the third party to get these emails from me bruno#XXXXXX.com rather than server.
How can I copy the email to a third party AND change the from address to be bruno#XXXXX.com?
Here's the procmail file:
cat .procmailrc
DROPPRIVS=yes
LOGFILE=$HOME/procmail.log
:0 c:
* B ?? C:......\....
! ABC#XYZ.com
:0 B:
* ^To: .*alerts#XXXXXX.com
! bruno#XXXXXX.com
Inject the headers you want with formail before piping to sendmail. (Recall that ! is basically a shorthand for | $SENDMAIL $SENDMAILFLAGS.)
Do I understand correctly that the first recipe is the one you would like to modify?
:0 c # No lockfile when forwarding
* B ?? C:......\....
| formail -I 'From: bruno#XXXXXX.com' \
| $SENDMAIL $SENDMAILFLAGS ABC#XYZ.com
Your second recipe similarly should not have a lock file; see http://www.iki.fi/era/procmail/mini-faq.html#locking
I published a repository using the version control program mercurial. More specifically, I installed the mercurial-server program and followed the instructions as given at
http://ekkescorner.wordpress.com/blog-series/git-mercurial/step-by-step-install-mercurial-server-on-ubuntu/
and
http://dev.lshift.net/paul/mercurial-server/docbook.html
. The repository works great, but the problem is that there are no emails sent to the users when we do an hg push after we made some changes.
I found several pages on the internet describing how to supposedly solve this problem, but none of them used mercurial-server to publish the repository and the activation of sending emails with an hg push seems to differ per method of publication.
How do I activate the emailing with an hg push in case of the mercurial-server package? Do I need to setup a SMTP server for mercurial?
The hgrc file that is in the .hg folder of my repository directory is as follows.
[paths]
default = ssh://hg#<ip_address>/jays/project
[extensions]
hgext.notify =
[hooks]
# Enable either changegroup or incoming.
# changegroup will send one email for each push,
# whereas incoming sends one email per changeset.
# Note: Configuring both is possible, but probably not
# what you want, you'll get one email for the group
# and one for each changeset in the group.
changegroup.notify = python:hgext.notify.hook
#commit.notify = python:hgext.notify.hook
#incoming.notify = python:hgext.notify.hook
[email]
from = <from#email.address>
[smtp]
host = <smtp.server.address>
# Optional options:
username = <smtp.server.username>
password = <smtp.server.password>
port = 465
tls = true
# local_hostname = me.example.com
# presently it is necessary to specify the baseurl for the notify
# extension to work. It can be a dummy value if your repo isn't
# available via http
[web]
baseurl = file:///
[notify]
# multiple sources can be specified as a whitespace separated list
sources = serve push pull bundle
# set this to False when you're ready for mail to start sending
test = false
# While the subscription information can be included in this file,
# (in which case, set: config =)
# having it in a separate file allows for it to be version controlled
# and for the option of having subscribers maintain it themselves.
config =
# you can override the changeset template here, if you want.
# If it doesn't start with \n it may confuse the email parser.
# here's an example that makes the changeset template look more like hg log:
#template = \ndetails: {baseurl}{webroot}/rev/{node|short}\nchangeset: {rev}:{node|short}\nuser: {author}\ndate: {date|date}\ndescription:\n{desc}\n
template = \ndetails: "{baseurl}{webroot}"\nchangeset: {rev}:{node|short}\nuser: {author}\ndate: {date|date}\ndescription:\n{desc}\n
# max lines of diffs to include (0=none, -1=all)
maxdiff = 1000
[reposubs]
* = <first#recipient.address>
I want to send an email from my vbscript code, the below code is working properly on my machine, but when I changed my machine, the code is no more able to send email.
There were no errors or problems occurred during run, but no emails were sent/delivered.
Has anyone else faced a problem like this?
Set objMessage = CreateObject("CDO.Message")
With objMessage
.From = SendFrom
.To = SendTo
.Subject = "Subject"
.Textbody = ""
.HTMLBody = "<b>Body</b>"
With .Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP.Gmail.Com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = "Username"
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "Password"
.Update
End With
.Send
End With
First, since you didn't post the entire code, check that your script doesn't contain a line
On Error Resume Next
If it does: remove the line and try again.
If you don't have that line in your script and the script doesn't raise an error and you can telnet mailserver 25 then it's almost certain that the mail server accepted the mail for delivery and the problem is somewhere upstream. Check the mail server logs.
You can verify if the server actually accepts mail like this:
C:\>telnet mailserver 25
220 mailserver ESMTP
HELO clientname
250 mailserver
MAIL FROM:<joe.average#example.com>
250 2.1.0 Ok
RCPT TO:<joe.average#example.com>
250 2.1.5 Ok
DATA
354 End data with <CR><LF>.<CR><LF>
Subject: test
test
.
250 2.0.0 Ok: queued as 4541E2227
QUIT
The line before the QUIT command means that the server accepted the mail. The actual response text may vary depending on which MTA is used, but every MTA will respond with some line like that when it accepts a message.
I would imagine this is a permissions issue or a firewall issue if it is working on your machine but not the production machine.
Carefully look at what is different, is one behind the firewall and other is not?
You need to install CDonts library first. Search on microsoft.com for CDONTS library and install the same.
If you want to send without installation then try the second method. you have to initialize the objects.
In that example i remove h in the link because i can't post links
CDO.MESSAGE
'Script to send an email through QTP nice one
Set oMessage = CreateObject("CDO.Message")
'==This section provides the configuration information for the remote SMTP server.
'==Normally you will only change the server name or IP.
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/sendusing") = 2
'Name or IP of Remote SMTP Server
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/smtpserver") =""
'Server port (typically 25)
oMessage.Configuration.Fields.Item _
("ttp://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
oMessage.Configuration.Fields.Update
oMessage.Subject = "Test Mail"
oMessage.Sender = ""
oMessage.To =""
'oMessage.CC = ""
'oMessage.BCC = ""
oMessage.TextBody = "Test Mail from QTP"&vbcrlf&"Regards,"&vbcrlf&"Test"
oMessage.Send
Set oMessage = Nothing