본문 바로가기

카테고리 없음

Tired of Outlook? Unleash Thunderbird Power: Bulk Emailing with VBA (Easy VBA for Your Home and Office Automation)

--------------240725 UPDATE
https://diycarebox.tistory.com/18

 

Update 1.1/2.1) Sending Bulk Automated Emails Using ThunderBird with VBA (Easy VBA/Work Automation)

July 25, 2024ThunderBird-easy-send-mail-1-ver.1.1ThunderBird-easy-send-mail-1-ver.2.1Here’s the update!What’s New (2024.07.25)File attachment feature has been improved.Now you can select files directly instead of typing in the file path. (But you can s

diycarebox.tistory.com

---------------------------

 

 

 

ThunderBird easy send mail 2 ver.2.00.xlsm
0.03MB

 

ThunderBird easy send mail 1 ver.1.00.xlsm
0.02MB

Title: Using ThunderBird with VBA to Mass Send Emails (Easy VBA/Automation Even Your Dog Can Do) After Getting Fed Up With Outlook

I recently got super frustrated with Outlook and couldn't get my Google account to log in no matter what, so I needed to find an easy way to mass send emails for work. I figured Excel VBA would be the way to go, but Outlook is such a pain to use. I found that ThunderBird integrates really well with VBA, so I decided to create my own automated email solution.

The key points:

  • I made this because Outlook sucks and I was tired of the hassle of manually sending emails one by one.
  • ThunderBird is a lot lighter and more user-friendly than Outlook, which is why I chose it.
  • This VBA script is designed to be super simple - even a dog could do it with a little bit of effort. No complicated Outlook object setup or anything like that.
  • I focused on making it easy for anyone to use, even if they don't have much VBA experience. Just follow the steps and you'll be cranking out mass emails in no time.
  • The script can handle things like sending different files to different recipients, which is great for things like payroll, invoices, dunning letters, etc. No more tedious manual work.
  • Experienced Excel/VBA users can also dig into the code and formulas to customize it for their specific needs. Hopefully it gives you some good ideas!

The only real downside compared to Outlook is that attaching files takes a bit more manual setup. But it's still way easier than the Outlook way of doing things.

Overall, I'm really happy with how this turned out and I hope it helps a lot of people free themselves from the drudgery of repetitive email tasks. Let me know if you have any other questions!

 

This is my VBA code. You can reference it and use it as needed.

 

-----------VER 1 수동발송--------------------------------------------------------------------------------------------------------------------------------

Sub 단추1_Click()
CarryOn = MsgBox("이메일주소, 메일내용은 잘 확인하셨나요??", vbYesNo, "ThunderBird easy send mail ver1")
If CarryOn = vbYes Then

End If

sCmd = "C:\Program Files\Mozilla Thunderbird\thunderbird" 'ThunderBird 파일 실행경로입니다. (x86)이신분들은 경로 수정해주세요'
Email = Sheets("mail").Range("C6").Value '받는사람주소입니다.'
Subject = Sheets("mail").Range("c8").Value ' 제목입니다.'
Content = Sheets("mail").Range("c9").Value '본문 내용입니다.'
Attch = Sheets("mail").Range("c10").Value '첨부파일 경로입니다.'
Carboncopy = Sheets("mail").Range("c7").Value '참조자 주소입니다.'

sCmd = sCmd & " -compose " & "to=" & Email
sCmd = sCmd & ",cc=" & Carboncopy
sCmd = sCmd & ",subject=" & Subject
sCmd = sCmd & ",attachment=" & Attch
sCmd = sCmd & ",body=" & Content
'MsgBox sCmd

Call Shell(sCmd, vbNormalFocus)

 

End Sub

-----------VER 1 자동발송--------------------------------------------------------------------------------------------------------------------------------

Sub 단추2_Click()
CarryOn = MsgBox("이메일주소, 메일내용은 잘 확인하셨나요??", vbYesNo, "ThunderBird easy send mail ver1")
If CarryOn = vbYes Then

End If

sCmd = "C:\Program Files\Mozilla Thunderbird\thunderbird" 'ThunderBird 파일 실행경로입니다. (x86)이신분들은 경로 수정해주세요'
Email = Sheets("mail").Range("C6").Value '받는사람주소입니다.'
Subject = Sheets("mail").Range("c8").Value ' 제목입니다.'
Content = Sheets("mail").Range("c9").Value '본문 내용입니다.'
Attch = Sheets("mail").Range("c10").Value '첨부파일 경로입니다.'
Carboncopy = Sheets("mail").Range("c7").Value '참조자 주소입니다.'

sCmd = sCmd & " -compose " & "to=" & Email
sCmd = sCmd & ",cc=" & Carboncopy
sCmd = sCmd & ",subject=" & Subject
sCmd = sCmd & ",attachment=" & Attch
sCmd = sCmd & ",body=" & Content
'MsgBox sCmd

Call Shell(sCmd, vbNormalFocus)

Application.Wait (Now + TimeValue("0:00:02"))

SendKeys "%+f", True
Application.Wait (Now + TimeValue("0:00:01"))

SendKeys "d", True 'd를 l로 바꾸면 나중에 보내기 가능합니다.'

End Sub

 

-----------VER 2 수동발송--------------------------------------------------------------------------------------------------------------------------------

Sub 단추1_Click()

Dim i As Long

CarryOn = MsgBox("이메일주소, 메일내용은 잘 확인하셨나요??", vbYesNo, "ThunderBird easy send mail ver1")
If CarryOn = vbYes Then

End If

 

For i = Sheets("mail").Range("a4").Value To Sheets("mail").Range("a5").Value

Sheets("mail").Range("a6").Value = i

sCmd = "C:\Program Files\Mozilla Thunderbird\thunderbird" 'ThunderBird 파일 실행경로입니다. (x86)이신분들은 경로 수정해주세요'
Email = Sheets("mail").Range("C6").Value '받는사람주소입니다.'
Subject = Sheets("mail").Range("c8").Value ' 제목입니다.'
Content = Sheets("mail").Range("c9").Value '본문 내용입니다.'
Attch1 = Sheets("mail").Range("c10").Value '첨부파일 경로입니다.'
Attch2 = Sheets("mail").Range("c11").Value '첨부파일 경로입니다.'
'Attch3 = sheets("mail").range("c12").value / 본 코드는 attch3(첨부파일3을 만들시 예제 코드입니다. 맨앞,뒤에 어퍼스트로피와 중간에 슬래쉬 지우고 셀값위치(c12)를 확인하시고 쓰세요'
Carboncopy = Sheets("mail").Range("c7").Value '참조자 주소입니다.'

sCmd = sCmd & " -compose " & "to=" & Email
sCmd = sCmd & ",cc=" & Carboncopy
sCmd = sCmd & ",subject=" & Subject
sCmd = sCmd & ",attachment=" & "'" & Attch1 & "," & Attch2 & "'" ' 중요 아래 첨부파일3를 사용하실때는 이 코드를 지우세요'
'/ sCmd = sCmd & ",attachment=" & "'" & Attch1 & "," & Attch2 & "," & Attch3 &"'" / 본 코드는 attch3(첨부파일3)을 만들시 예제 코드입니다. 앞뒤 슬러시 안쪽에 있는 코드를 참고하세요'
sCmd = sCmd & ",body=" & Content
'MsgBox sCmd

Call Shell(sCmd, vbNormalFocus)

Application.Wait (Now + TimeValue("0:00:02"))

SendKeys "%+f", True
Application.Wait (Now + TimeValue("0:00:01"))

SendKeys "l", True 'd를 l로 바꾸면 나중에 보내기 가능합니다.'

Next i

MsgBox "모든 이메일은 ThunderBird 외부편지함에 들어갔습니다. 프로그램 실행하셔서 수동으로 전송을 눌러주세요", vbInformation, "ThunderBird easy send mail ver1"

End Sub

-----------VER 2 자동발송--------------------------------------------------------------------------------------------------------------------------------

Sub 단추2_Click()
Dim i As Long

CarryOn = MsgBox("이메일주소, 메일내용은 잘 확인하셨나요??", vbYesNo, "ThunderBird easy send mail ver1")
If CarryOn = vbYes Then

End If

 

For i = Sheets("mail").Range("a4").Value To Sheets("mail").Range("a5").Value

Sheets("mail").Range("a6").Value = i

sCmd = "C:\Program Files\Mozilla Thunderbird\thunderbird" 'ThunderBird 파일 실행경로입니다. (x86)이신분들은 경로 수정해주세요'
Email = Sheets("mail").Range("C6").Value '받는사람주소입니다.'
Subject = Sheets("mail").Range("c8").Value ' 제목입니다.'
Content = Sheets("mail").Range("c9").Value '본문 내용입니다.'
Attch1 = Sheets("mail").Range("c10").Value '첨부파일 경로입니다.'
Attch2 = Sheets("mail").Range("c11").Value '첨부파일 경로입니다.'
'Attch3 = sheets("mail").range("c12").value / 본 코드는 attch3(첨부파일3을 만들시 예제 코드입니다. 맨앞,뒤에 어퍼스트로피와 중간에 슬래쉬 지우고 셀값위치(c12)를 확인하시고 쓰세요'
Carboncopy = Sheets("mail").Range("c7").Value '참조자 주소입니다.'

sCmd = sCmd & " -compose " & "to=" & Email
sCmd = sCmd & ",cc=" & Carboncopy
sCmd = sCmd & ",subject=" & Subject
sCmd = sCmd & ",attachment=" & "'" & Attch1 & "," & Attch2 & "'" ' 중요 아래 첨부파일3를 사용하실때는 이 코드를 지우세요'
'/ sCmd = sCmd & ",attachment=" & "'" & Attch1 & "," & Attch2 & "," & Attch3 &"'" / 본 코드는 attch3(첨부파일3)을 만들시 예제 코드입니다. 앞뒤 슬러시 안쪽에 있는 코드를 참고하세요'
sCmd = sCmd & ",body=" & Content
'MsgBox sCmd

Call Shell(sCmd, vbNormalFocus)

Application.Wait (Now + TimeValue("0:00:02"))

SendKeys "%+f", True
Application.Wait (Now + TimeValue("0:00:01"))

SendKeys "d", True 'd를 l로 바꾸면 나중에 보내기 가능합니다.'
Application.Wait (Now + TimeValue("0:00:01"))

Next i

MsgBox "모든 이메일 발송이 완료되었습니다.", vbInformation, "ThunderBird easy send mail ver1"

End Sub