Send Mail Via Outlook Even If Outlook Is Closed

Status
Not open for further replies.
O

osfreedom

Hi,

The scenario is send email from outlook 2010 (or any mail to link ex: example@example.com ) without opening outlook, i have tried in outlook 2010 without opening outlook , the message is not going to the receiver, its keeping inside the outbox folder, when i open the outlook 2010 send & receive then only its sending to reciever.

please help me to automate this task without open outlook 2010.
 
Hi,







Maybe you can try this code:







Private Sub CommandButton10_Click() Dim OutApp As Object Dim OutMail As Object Dim strbody As String Set OutApp = CreateObject(" Outlook.Application" ) OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = " me@here.com" .CC = " " .BCC = " " .Subject = " The Filefor #" & Chr(32) & Range(" H4" ) & " has been updated." .Body = " Please review." & vbCrLf & vbCrLf & ActiveWorkbook.FullName .Send 'or use .Display .ReadReceiptRequested = True End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing Dim Msg, Style, Title Msg = " E-mail has been sent " & Chr(13) & Chr(10) & " Press OK to continue." Style = vbOKOnly + vbInformation Title = " Open Issues List" Response = MsgBox(Msg, Style, Title, Help, Ctxt) End Sub
 
Hi,

Maybe you can try this code:

Private Sub CommandButton10_Click() Dim OutApp As Object Dim OutMail As Object Dim strbody As String Set OutApp = CreateObject(" Outlook.Application" ) OutApp.Session.Logon Set OutMail = OutApp.CreateItem(0) On Error Resume Next With OutMail .To = " me@here.com" .CC = " " .BCC = " " .Subject = " The Filefor #" & Chr(32) & Range(" H4" ) & " has been updated." .Body = " Please review." & vbCrLf & vbCrLf & ActiveWorkbook.FullName .Send 'or use .Display .ReadReceiptRequested = True End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing Dim Msg, Style, Title Msg = " E-mail has been sent " & Chr(13) & Chr(10) & " Press OK to continue." Style = vbOKOnly + vbInformation Title = " Open Issues List" Response = MsgBox(Msg, Style, Title, Help, Ctxt) End Sub

I know this is late coming on as I would like to be able to do this in both outlook 2010 and 2007. I think that outlook does this in 2003 without any changes.

Forgive me, but what do i do with the above code? Why doesn't outlook just do it?

Thank you,

Steve
 
Here is a properly formatted version of the macro. This works with Excel 2010 and Outlook 2010 with an Exchange mailbox - it triggers the "something is trying to send a message" alert but the message is sent before Outlook shuts down.




I'm not sure it will work with SMTP servers as outlook won't be open long enough to send it - you will need to use Send Immediately. Exchange mailbox is somewhat better for sending without fully opening Outlook than accounts that use a smtp server.




I added the line to increment the # in H1 so I could repeatedly test it and see if the message arrived at the other address.




To use: open the VB Editor in Excel and double click on ThisWorkBook. Paste the macro and change the email address. enter a number in cell H1. Run the macro.






Code:

 
 
Private Sub CommandButton10_Click()
 
 
Dim OutApp As Object
 
 
Dim OutMail As Object
 
 
Dim strbody As String
 
 
Set OutApp = CreateObject("Outlook.Application")
 
 
OutApp.Session.Logon
 
 
Set OutMail = OutApp.CreateItem(0)
 
 
On Error Resume Next
 
 

 
 
ActiveSheet.Range("H1") = ActiveSheet.Range("H1") + 1
 
 

 
 
With OutMail
 
 
> To = "me@here.com"
 
 
> CC = ""
 
 
> BCC = ""
 
 
> Subject = "The File for #" & Range("H1") & " has been updated."
 
 
> Body = "Please review." & vbCrLf & vbCrLf & ActiveWorkbook.FullName
 
 
> Send 'or use .Display
 
 
> ReadReceiptRequested = True
 
 
End With
 
 

 
 
On Error GoTo 0
 
 
Set OutMail = Nothing
 
 
Set OutApp = Nothing
 
 
Dim Msg, Style, Title
 
 
Msg = "E-mail has been sent " & Chr(13) & Chr(10) & "Press OK to continue."
 
 
Style = vbOKOnly + vbInformation
 
 
Title = "Open Issues List"
 
 
Response = MsgBox(Msg, Style, Title, Help, Ctxt)
 
 
End Sub
 
Status
Not open for further replies.
Similar threads
Thread starter Title Forum Replies Date
W Outlook 365 I am getting the "Either there is no default mail client" error when I try to send an email on excel Office 365 Using Outlook 1
T Outlook creates a copie of every mail I send Using Outlook.com accounts in Outlook 4
M Outlook, send to > mail recipient - results in plain text email Using Outlook 1
S Outlook Macro to send auto acknowledge mail only to new mails received to a specific shared inbox Outlook VBA and Custom Forms 0
soadfan Outlook won't send e-mail when offline Outlook VBA and Custom Forms 19
K Delay Send and Mail Merge Outlook VBA and Custom Forms 4
undercover_smother Automatically Forward All Sent Mail and Delete After Send Outlook VBA and Custom Forms 10
stephen li VBA Outlook send mail automatically by specified outlook mail box Outlook VBA and Custom Forms 1
I Outlook 2013 Send mail - it just sticks in Outbox Using Outlook.com accounts in Outlook 0
Tim King Send mail from MSWord through Outlook Using Outlook 3
R OL2010 - Send to Mail Recipient going to wrong account Using Outlook 1
R Unable to send mail using Cox.net Using Outlook 1
Emerogork How do I activate the "Send Again" option in Sent Mail folder? Using Outlook 1
S Check if two organisition is added then i have to give managers passward creteria to send mail Using Outlook 1
A Application_ItemSend not accessed when sending email outside outlook (i.e. word or send to mail from Using Outlook 7
D VBA Script (Ask to where to save send mail) Outlook VBA and Custom Forms 1
D Create additional custom flag descriptions (other than Send E-Mail, Call etc.) Using Outlook 1
A yahoo mail doesn't send or receive reliably Using Outlook 1
Z Send mail and contents of body from ms word document Using Outlook 1
H Outlook 2010 unable to send iCloud account e-mail after iOS 7 upgrade Using Outlook 12
C Insert a Date Picker for Send Mail Subject Using Outlook 1
C MsgBox Everytime I send a mail Using Outlook 1
L "sometimes" cant send mail, we have to copy and paste the message and resend? Using Outlook 2
K A program is trying to send an e-mail message on your behalf... Using Outlook 1
L Send E-mail with VBA code from [E-mail Distribution Group] if I have “Send as” Using Outlook 6
S Outllok 2007 VBA code to send mail automatically from drafts folder Using Outlook 1
A How to send Personalized attachment while sending mass mail Using Outlook 1
G Rule: IF mail received by X, THEN no action; IF mail not received by X, SEND Using Outlook 0
E Outlook cannot connect to your incoming (POP3) e-mail server/Cannot send mess. Using Outlook 0
T HELP - Send e-mail verification text box Using Outlook.com accounts in Outlook 10
B How do I create and send mail in Outlook 2003 from code? Using Outlook 5
J Outlook 2003 does not send or receive imap mail from server Using Outlook 0
R OL10 - Send To "Mail Recipient" doesn't go to default email account Using Outlook 23
C send mail every days Outlook VBA and Custom Forms 7
D How can I send a group email to a color catagory re: yellow= mail BCM (Business Contact Manager) 1
T Get rid of having to type verification characters to send mail BCM (Business Contact Manager) 2
H how to send a e-mail with a annex automaticly Outlook VBA and Custom Forms 3
O Scheduled Task Fails running Code to send Outlook Mail from Excel. Outlook VBA and Custom Forms 9
D Outlook 2007 Will Not Send Mail From C# Application Outlook VBA and Custom Forms 7
P Move mail item after send Outlook VBA and Custom Forms 2
G Send Mail If Statement Outlook VBA and Custom Forms 4
Q Error code appears when I try to send e mail Using Outlook 2
S Reading mailitem after mail is send give runtime error. Outlook VBA and Custom Forms 1
C Synchronization and taking forever to send Using Outlook 2
D Send on behalf of does not store the base mailbox Using Outlook 0
R Outlook 365 VBA AUTO SEND WITH DELAY FOR EACH EMAIL Outlook VBA and Custom Forms 0
S Outlook 2002- "Send" button has disappeared. Help please. Using Outlook 1
TomHuckstep Remove Send/Receive All Folders (IMAP/POP) button from Outlook 365 Ribbon Using Outlook 2
J Macro to send email as alias Outlook VBA and Custom Forms 0
F Add a category before "Send an Email When You Add an Appointment to Your Calendar" Outlook VBA and Custom Forms 0

Similar threads

Back
Top