|
-
Oct 18th, 2010, 12:48 PM
#1
Thread Starter
Addicted Member
Help with objmessage email sending using authentication
Hi all, back again!
My host have changed authentication on their email server which has affected this script in my program. My emails now come back as undelivered. The script worked previous to these changes, so I am looking at this part of the code only (there is more code of course, but I am guessing this is where I need to make changes..
Code:
objmessage.TextBody = emailbody
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusername") = "[email protected]"
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "mypassword"
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtp.server"
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = 0
objmessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 30
objmessage.Configuration.Fields.Update
objmessage.Send
Thanks in advance
-
Oct 18th, 2010, 12:58 PM
#2
Re: Help with objmessage email sending using authentication
"My host have changed authentication" - what changes have they made ?
-
Oct 18th, 2010, 04:57 PM
#3
Re: Help with objmessage email sending using authentication
If they actually are returned as undeliverable you have an entirely different kind of problem. It means the To address is wrong or a server along the path to the destination rejected the message.
Looking at the full headers of the bounced email might tell you why.
-
Oct 19th, 2010, 01:28 AM
#4
Thread Starter
Addicted Member
Re: Help with objmessage email sending using authentication
This is what I get:
host
x said: 551 This mail server requires
authentication before sending mail from a locally hosted domain. Please
reconfigure your mail client to authenticate before sending mail. (in reply
to MAIL FROM command)
-
Oct 19th, 2010, 01:59 AM
#5
Addicted Member
Re: Help with objmessage email sending using authentication
Hi,
Looks like you have not specified the Recipient...
Code:
objmessage.From = txtFrom.Text
objmessage.To = txtTo.Text
objmessage.Subject = "Whatever.. Subject..."
objmessage.TextBody = eMailBody
Regards
Veena
-
Oct 19th, 2010, 03:14 AM
#6
Thread Starter
Addicted Member
Re: Help with objmessage email sending using authentication
Hi Veena, thanks for responding.
Apologies, I did not include more of the code further above, the recipient is included. I do not have access to the code from work, but will repost it all later, I only included that part as I assumed thats where the error would be.
Thanks again.
-
Oct 19th, 2010, 12:31 PM
#7
Thread Starter
Addicted Member
Re: Help with objmessage email sending using authentication
This is the rest of the code for this part
Code:
Set omsg = CreateObject("cdo.message")
Set omsg = Nothing
Set objmessage = CreateObject("CDO.Message")
' START EDIT HERE
objmessage.Subject = "my subject"
objmessage.From = "my email address"
objmessage.To = "destination emial address"
anotherday = Now
emailbody = "message body"
-
Oct 19th, 2010, 01:19 PM
#8
Re: Help with objmessage email sending using authentication
A good exercise for the Heart is to bend down and help another up...
Please Mark your Thread " Resolved", if the query is solved
MyGear:
★ CPU ★ Ryzen 5 5800X
★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
★ Keyboard ★ TVS Electronics Gold Keyboard
★ Mouse ★ Logitech G502 Hero
-
Oct 19th, 2010, 05:27 PM
#9
Re: Help with objmessage email sending using authentication
You may find that your mail relay demands POP-before-SMTP authentication now. You can't do this via CDO.
You'd need to authenticate via a POP3 connection first, and then for a small window of time the SMTP server will accept a connection from the same IP address. Sometimes this SMTP connection requires authentication too, but generally not.
This is meant to defeat people using SMTP bots and exploiting mail servers as relays, though many have simply accommodated to the new requirement.
-
Oct 20th, 2010, 01:26 AM
#10
Addicted Member
Re: Help with objmessage email sending using authentication
Hi,
Entire code looks OK to me... I use similar code for GMail SMTP.. and it works perfectly..
without VB6, can you send/receive mails with your SMTP directly (I mean thru browser)...?
Regards
Veena
-
Oct 20th, 2010, 02:45 AM
#11
Re: Help with objmessage email sending using authentication
as suggested by veena, if you can no longer send via your default smpt server, try some free smpt server, like gmail or gmx, both work with cdo, settings posted in this forum, there are others
i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next
dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part
come back and mark your original post as resolved if your problem is fixed
pete
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
|