Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mail Vbscript Tech Support Message

Status
Not open for further replies.

Rubymoon

IS-IT--Management
Jul 7, 2008
13
CA
Ok, I have been messing with this thing for hours and I am not sure I know what to do with it anymore, the goal of this is, I want to make a link to this for people to send mail to the tech when they have a problem.

So what I tried was to make a msgbox and enter the text they want (quite short, its for quick messages) but I can't figure out a way to make it wait before sending the e-mail. I've tried with different loops and i fail at loops, let's face it. :p

If someone would be willing to spare a couple of minutes i would be more than grateful, thank you very much everyone

-Tomiko

**********************************************

Const cdoSendUsingPickup = 1 'Send message using the local SMTP service pickup directory.
Const cdoSendUsingPort = 2 'Send the message using the network (SMTP over the network).

Const cdoAnonymous = 0 'Do not authenticate
Const cdoBasic = 1 'basic (clear-text) authentication
Const cdoNTLM = 2 'NTLM

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "Example CDO Message"
objMessage.From = """Me"" <francis.desjardins.eqcs@gmail.com>"
objMessage.To = "francis.desjardins.eqcs@gmail.com"
objMessage.TextBody = "This is some sample message text.." & vbCRLF & "It was sent using SMTP authentication."

'==This section provides the configuration information for the remote SMTP server.

objMessage.Configuration.Fields.Item _
(" = 2

'Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
(" = "smtp.gmail.com"

'Type of authentication, NONE, Basic (Base64 encoded), NTLM
objMessage.Configuration.Fields.Item _
(" = cdoBasic

'Your UserID on the SMTP server
objMessage.Configuration.Fields.Item _
(" = "francis.desjardins.eqcs@gmail.com"

'Your password on the SMTP server
objMessage.Configuration.Fields.Item _
(" = "********"

'Server port (typically 25)
objMessage.Configuration.Fields.Item _
(" = 25

'Use SSL for the connection (False or True)
objMessage.Configuration.Fields.Item _
(" = True

'Connection Timeout in seconds (the maximum time CDO will try to establish a connection to the SMTP server)
objMessage.Configuration.Fields.Item _
(" = 60

objMessage.Configuration.Fields.Update

'==End remote SMTP server configuration section==

objMessage.Send

*******************************************
 
You may consider the InputBox function:
objMessage.TextBody = InputBox("enter the text you want")

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Thank you very much for the tip, it was very usefull, it wasn't waiting for input with my first version, with Inputbox it waits, its awesome, tyvm.

If anyone want to use the code for their own usesage, here it is, my final version.

________________________________________________________

Const cdoSendUsingPickup = 1
Const cdoSendUsingPort = 2
Const cdoAnonymous = 0
Const cdoBasic = 1
Const cdoNTLM = 2

Set objMessage = CreateObject("CDO.Message")

objMessage.Subject = "Health Centre - " & InputBox ("Please Enter Your Name")
objMessage.From = "francis.desjardins.eqcs@gmail.com"
objMessage.To = "crystal.desjardins@eqcs.ca"
objMessage.TextBody = InputBox ("Tech Support Messanger" & vbCrLf & vbCrLf & _
"Please State The Problem" & vbCrLf & "And Press Ok When Finished")

objMessage.Configuration.Fields.Item (" = 2
objMessage.Configuration.Fields.Item (" = "smtp.gmail.com"
objMessage.Configuration.Fields.Item (" = cdoBasic
objMessage.Configuration.Fields.Item (" = "francis.desjardins.eqcs@gmail.com"
objMessage.Configuration.Fields.Item (" = "********"
objMessage.Configuration.Fields.Item (" = 25
objMessage.Configuration.Fields.Item (" = True
objMessage.Configuration.Fields.Item (" = 90
objMessage.Configuration.Fields.Update

If objMessage.TextBody = "" Then
MsgBox "You Didn't Enter A Problem." & vbCrLf & vbCrLf & "Please Try Again."

Else
objMessage.Send

End If
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top