{"thread":{"id":"37626","subject":"Specifying account profile in MSMTP","startedAt":"2014-09-24T16:52:51Z","lastAt":"2014-10-19T00:46:02Z","messageCount":2,"participants":["Robert Dailey","Eric Wong"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"249831","messageId":"CAHd499C5FZietAxQYBFwk+Zm0AeLWSADog7+=W0Fnm6G1sPSHw@mail.gmail.com","threadId":"37626","inReplyTo":null,"subject":"Specifying account profile in MSMTP","fromName":"Robert Dailey","fromEmail":"rcdailey.lists@gmail.com","sentAt":"2014-09-24T16:52:51Z","receivedAt":"2014-09-24T16:52:51Z","isPatch":false,"sender":{"key":"rcdailey.lists@gmail.com","avatar":null},"body":"Hey guys,\n\nI'm using MSMTP to define 2 accounts: Work email and personal email.\nIf I send patches via email through Git at work, I want to use my work\nSMTP server and account information. Likewise at home for personal\nprojects, I want to use my personal SMTP account.\n\nI put my .gitconfig in Dropbox and I share it across all of my\nmachines, so I avoid putting my SMTP server information in my global\nconfig because I'd then have to use the same account everywhere.\nHowever, I do not define a \"default\" account in my MSMTP file (which\nis also in dropbox, in fact my whole home directory is in there).\n\nIs there a way to specify the MSMTP account to use at the command line\nwhen I run `git send-email`? If not, are there other good solutions to\nthis problem?\n\nIf not, I might contribute an option to send-email to feed down into\nMSMTP.exe so that I can specify the account to use. I'm not familiar\nat all with MSMTP so I want to ask here first. Thank you!\n"},{"id":"250814","messageId":"20141019004602.GA1977@dcvr.yhbt.net","threadId":"37626","inReplyTo":"CAHd499C5FZietAxQYBFwk+Zm0AeLWSADog7+=W0Fnm6G1sPSHw@mail.gmail.com","subject":"Re: Specifying account profile in MSMTP","fromName":"Eric Wong","fromEmail":"normalperson@yhbt.net","sentAt":"2014-10-19T00:46:02Z","receivedAt":"2014-10-19T00:46:02Z","isPatch":false,"sender":{"key":"e@80x24.org","avatar":null},"body":"Robert Dailey <rcdailey.lists@gmail.com> wrote:\n> Hey guys,\n> \n> I'm using MSMTP to define 2 accounts: Work email and personal email.\n> If I send patches via email through Git at work, I want to use my work\n> SMTP server and account information. Likewise at home for personal\n> projects, I want to use my personal SMTP account.\n> \n> I put my .gitconfig in Dropbox and I share it across all of my\n> machines, so I avoid putting my SMTP server information in my global\n> config because I'd then have to use the same account everywhere.\n> However, I do not define a \"default\" account in my MSMTP file (which\n> is also in dropbox, in fact my whole home directory is in there).\n> \n> Is there a way to specify the MSMTP account to use at the command line\n> when I run `git send-email`? If not, are there other good solutions to\n> this problem?\n\nmsmtprc can be configured to picks accounts based on the envelop sender\nspecified by git send-email.\n\nI make sure my email address in the git commits is correct and use\nuse envelopesender=auto for git send-email when using msmtp.\n\nConfig examples below:\n\n----------- ~/.gitconfig ---------------\n[sendemail]\n\tsmtpserver = /usr/bin/msmtp\n\tenvelopesender = auto\n\n---- /path/to/project_a/.git/config ----\n[user]\n\temail = a@example.com\n---- /path/to/project_b/.git/config ----\n[user]\n\temail = b@example.com\n------------ ~/.msmtprc ----------------\naccount a\nhost ...\nfrom a@example.com\nuser a\npassword ...\nauth ...\n\naccount b\nhost ...\nfrom b@example.com\nuser b\npassword ...\nauth ...\n"}]}