|
-
Feb 17th, 2007, 04:39 PM
#1
Thread Starter
Addicted Member
[RESOLVED] Send Email
Guys.
I am converting a vbscript over to vb 2005. When moving the code over below it seems vb 2005 does not like , on each of the new lines.
Can someone please let me know what i should replace the , with?
objEmail = CreateObject("CDO.Message")
objEmail.From = "[email protected]"
objEmail.To = "[email protected]"
objEmail.Subject = "New User - " & strFirst & " " & strLast & " Elite Account Details "
objEmail.Textbody = Join( Array( _
"****Automatic email****," _
, " "_
, "Please note London IT have created a new user."_
, " "_
, "Name: " & strFirst & " " & strLast &" " _
, " "_
, "Initials: " & strUser & " "_
, " "_
, "Elite Password: " & objPassDlg.password & " "_
, " "_
, "Department: " & sDepartment & " "_
, " "_
, "Office Location: " & WithersOffice.Value & " "_
, " "_
, " "_
, "Accounts could you please add this user to Elite please and do your Magic!"_
, " "_
, "Regards"_
, " "_
, "European IT Helpdesk"_
, "Withers LLP"_
, " "_
, "+44 (0) 207 597 6440"_
, "[email protected]"_
, " "_
, "****Please note this email was automatically generated from the IT User Creation Script****"_
, " "_
, "Please contact the European IT Helpdesk x6440 with any issues"_
, " "_
, "This Account has been created by: " & strLoggedonUser & ""_
, " " ), vbCrLf )
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = _
"IP ADDRESS HERE"
objEmail.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update()
objEmail.Send()
End If
Last edited by cjwallace; Feb 18th, 2007 at 12:26 PM.
-
Feb 17th, 2007, 08:08 PM
#2
Fanatic Member
Re: Send Email
Look at the System.Net.Mail namespace.
Also, check out this link. http://www.systemnetmail.com/
My.Settings.Signature = String.Empty
-
Feb 18th, 2007, 06:41 AM
#3
Thread Starter
Addicted Member
Re: Send Email
Hi mate and thanks very much for the reply.
Ok i have taken a look at the site you said and the bit of code i think i need to use is below. Now as you can see from my first post my email contains multiple lines in the body. Do you know how i can make the code below multiple lines?
'create the mail message
Dim mail As New MailMessage()
'set the addresses
mail.From = New MailAddress("[email protected]")
mail.To.Add("[email protected]")
'set the content
mail.Subject = "This is an email"
mail.Body = "this is a sample body with html in it. <b>This is bold</b> <font color=#336699>This is blue</font>"
mail.IsBodyHtml = True
'send the message
Dim smtp As New SmtpClient("127.0.0.1")
smtp.Send(mail)
Thanks again for any help you may give.
-
Feb 18th, 2007, 07:00 AM
#4
Addicted Member
Re: Send Email
I've maked an mailscript a few days ago, check http://www.vbforums.com/showthread.php?t=452345
Hope it's help!
Maybe will <br> wil help!
-
Feb 18th, 2007, 07:23 AM
#5
Thread Starter
Addicted Member
Re: Send Email
Thanks for the reply.
I had a look but i am still unable to work out how to make the body of the email on more than one line.
-
Feb 18th, 2007, 08:49 AM
#6
Re: Send Email
You could try putting in an Environment Newline
VB Code:
smail.Body = "Hello there" & Environment.NewLine & "Will this be on a new line"
Or perhaps using the <br> tags would work in html. If I remember it marks a new line. Same as putting things in <p>This is a paragraph</p> does.
See if any of them work.
-
Feb 18th, 2007, 09:12 AM
#7
Thread Starter
Addicted Member
Re: Send Email
Thank you i will give this ago.
-
Feb 18th, 2007, 09:17 AM
#8
Thread Starter
Addicted Member
Re: Send Email
Oh just one more thing. How can i do it so that my code is not scrolling off the page? i have about 15 lines of my email and i would rather my code go down the page rather than accross.
Also if i wanted two new line would i just use
& Environment.NewLine & & Environment.NewLine &
Many thanks
Last edited by cjwallace; Feb 18th, 2007 at 09:39 AM.
-
Feb 18th, 2007, 12:17 PM
#9
Thread Starter
Addicted Member
Re: Send Email
Got it. i just need to use & Environment.NewLine & _
-
Feb 18th, 2007, 12:24 PM
#10
Re: Send Email
Oh, that. I thought you were still referring to it going across in the actual email being sent.
Well, glad you found everything. Resolve etc... if you are all done.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|