Send mail automatically

P

Peter Bircher

Hi all

I have written a routine (see below) to create an email from the clients
machine
This is triggered when the contents of a specific cell is changed

It works well except that I would like it to send it "behind the scene"
without giving the client the option of not sending it!

I don't know whether this is possible . . .

Sub SendEmail()
Dim AddressString As String

AddressString = "mailto:" & "(e-mail address removed)" & "?subject=" _
& "This is the subject" & "&body=" & "This is in the body"

ThisWorkbook.FollowHyperlink Address:=AddressString

End Sub

Is there some code that I can insert that will go on to put it, preferably
hidden (like a read receipt), in the outbox automatically?

Thanks, in anticipation
Peter Bircher

www.automatexcel.co.za
 
J

Jim

Try this

Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Set objmail = objol.createitem(olmailitem)

With objmail
.To = "XXXXXXXXX " 'enter in here the email address
' .cc = "whoever" 'enter in here the email address
.Subject = "test email for Peter Bircher"
.Body = "Please find attached the test email" & _
vbCrLf & "If you have any queries can you please let me
know" & vbCrLf
.NoAging = True
' .Attachments.Add pathname 'adds attachment to email
.display
End With
Set objmail = Nothing
Set objol = Nothing
SendKeys "%{s}", True 'send the email without prompts

"Peter Bircher" wrote in message

Hi all

I have written a routine (see below) to create an email from the clients
machine
This is triggered when the contents of a specific cell is changed

It works well except that I would like it to send it "behind the scene"
without giving the client the option of not sending it!

I don't know whether this is possible . . .

Sub SendEmail()
Dim AddressString As String

AddressString = "mailto:" & "(e-mail address removed)" & "?subject=" _
& "This is the subject" & "&body=" & "This is in the body"

ThisWorkbook.FollowHyperlink Address:=AddressString

End Sub

Is there some code that I can insert that will go on to put it, preferably
hidden (like a read receipt), in the outbox automatically?

Thanks, in anticipation
Peter Bircher

www.automatexcel.co.za
 
P

Peter Bircher

Thank Jim

Will give it a try

My concern is if they don't have MS Outlook :(
What about Windows Mail? or some other.

I would like it to execute regardless of the mail program they use.

Peter Bircher

www.automatexcel.co.za

"Jim" wrote in message
Try this

Dim objol As New Outlook.Application
Dim objmail As MailItem
Set objol = New Outlook.Application
Set objmail = objol.createitem(olmailitem)

With objmail
.To = "XXXXXXXXX " 'enter in here the email address
' .cc = "whoever" 'enter in here the email address
.Subject = "test email for Peter Bircher"
.Body = "Please find attached the test email" & _
vbCrLf & "If you have any queries can you please let me
know" & vbCrLf
.NoAging = True
' .Attachments.Add pathname 'adds attachment to email
.display
End With
Set objmail = Nothing
Set objol = Nothing
SendKeys "%{s}", True 'send the email without prompts

"Peter Bircher" wrote in message

Hi all

I have written a routine (see below) to create an email from the clients
machine
This is triggered when the contents of a specific cell is changed

It works well except that I would like it to send it "behind the scene"
without giving the client the option of not sending it!

I don't know whether this is possible . . .

Sub SendEmail()
Dim AddressString As String

AddressString = "mailto:" & "(e-mail address removed)" & "?subject=" _
& "This is the subject" & "&body=" & "This is in the body"

ThisWorkbook.FollowHyperlink Address:=AddressString

End Sub

Is there some code that I can insert that will go on to put it, preferably
hidden (like a read receipt), in the outbox automatically?

Thanks, in anticipation
Peter Bircher

www.automatexcel.co.za
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top