Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 Other Development Tools
 Sending mails with CDO

Author  Topic 

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-13 : 19:37:45
Hello,
I have been using dundas mailer to send emails, but noticed it doesnt deliver to hotmail and cant resolve it

I am trying out this CDO script

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From="mail@mail.com"
myMail.To="mail@mail.com"
myMail.TextBody="This is a message."
myMail.Send
set myMail=nothing
%>


i got it from here
http://www.w3schools.com/asp/asp_send_email.asp

but it still does not work. How do i get around this webmailer issue ?

Afrika

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-02-13 : 23:20:57
This code is for classic asp. Can you tell us, where you are using this mailer function?


Karunakaran
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-02-14 : 01:20:52
quote:
Originally posted by karuna

This code is for classic asp. Can you tell us, where you are using this mailer function?


Karunakaran



Probably in an ASP page


It sounds like your problem is that either your SMTP server is incorrectly configured, or hotmail is blocking your IP. If your site works for some addresses I don't think it's your code. You should talk to your hosting provider about how their SMTP servers are configured.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-14 : 01:36:20
quote:
Originally posted by karuna
This code is for classic asp. Can you tell us, where you are using this mailer function?


Am running the mailer function as it is on the server side, but it fails to send any mail
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-14 : 03:56:13
Ok, has anyone got any simple ASP or .NET mailer function ?
or does anyone know why the CDO app above is not working ?
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-02-14 : 05:01:54
quote:
Originally posted by afrika

Ok, has anyone got any simple ASP or .NET mailer function ?
or does anyone know why the CDO app above is not working ?



If you are using classic asp
try this
Set myMail = Server.CreateObject("CDO.NewMessage") instead of the first line



Karunakaran
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-02-14 : 05:03:28
http://www.4guysfromrolla.com/webtech/080801-1.shtml
http://www.aspfree.com/c/a/ASP-Code/Send-emails-to-multiple-recipients-using-addresses-from-a-database/

See if this helps. First link is for ASP.NET and second link for ASP

Karunakaran
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-02-14 : 05:58:41
africa, why don't be a bit more specific about what the problem is.

Do you get an error ?
or does the mail just not arrive ? Does it work for some mail providers but not Hotmail, or does it not work for anyone.

Your mail code looks fine, have you looked into my SMTP server suggestion ?



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-14 : 09:03:07
Thanks Karuna, Merkin

problem is thus.

1. When i use dundas, i get deliver to all mails during signups except hotmail and gmail.
2. For the script posted above (ie the CDO ), i dont get delivery at all.

Regarding the configuration of the server SMTP, i really dont think thats the problem, because its hosted with our provider we have been using since 2002, on win 2003 server.

Am testing the new line, would brb...

And also looking at the links
Afrika
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2006-02-14 : 15:59:59
If you get some mails with Dundas, then the mail component is delivering to the SMTP server. There is nothing wrong with your code or the component.

If Hotmail and GMail aren't getting the mail, either your SMTP server is incorrectly configured, OR your SMTP server has been blocked by those providers.

I seem to remember saying this a few months ago to you, but you won't listen. Stop messing with the code, the problem is elsewhere.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson
Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-02-14 : 16:22:42
As Merkin says, which SMTP server are you specifying with Dundas, and which one are you specifying (if any) with CDO? From your sample code, it appeared that you were using your local web server -- is that how you did it with Dundas?

By the way, if you are using .NET, then it has Mail built into the framework -- you should just use that.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-14 : 16:44:07
quote:
Originally posted by Merkin

If you get some mails with Dundas, then the mail component is delivering to the SMTP server. There is nothing wrong with your code or the component.

If Hotmail and GMail aren't getting the mail, either your SMTP server is incorrectly configured, OR your SMTP server has been blocked by those providers.

I seem to remember saying this a few months ago to you, but you won't listen. Stop messing with the code, the problem is elsewhere.



Damian
"A foolish consistency is the hobgoblin of little minds." - Emerson



...really ???
I guess its 'cos am searching for a solution
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-02-14 : 22:14:11
quote:
Originally posted by jsmith8858

As Merkin says, which SMTP server are you specifying with Dundas, and which one are you specifying (if any) with CDO? From your sample code, it appeared that you were using your local web server -- is that how you did it with Dundas?

By the way, if you are using .NET, then it has Mail built into the framework -- you should just use that.



Probably if afrika can post the code used for Dundas mailer, that will help to identify whether the mailer component uses local SMTP or other SMTP's.

Thanks

Karunakaran
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-15 : 01:40:19
quote:
Originally posted by Merkin

africa, why don't be a bit more specific about what the problem is.

Do you get an error ?
or does the mail just not arrive ? Does it work for some mail providers but not Hotmail, or does it not work for anyone.

Your mail code looks fine, have you looked into my SMTP server suggestion ?



Damian




Hello Guys,
i really do need a solution around this, simply because the problem has to do with signup to our portal.

Whenever a user signs up, he gets a confirmation message to his box. This we noticed failed to hotmail, so we have been trying to work around it.

The site is hosted remotely and the page is called from an XML serverside HTTP request object.


Hi karuna,
here's is my dundas code, above is the CDO Code am trying to work with.

rgds
Ehi



<%
'most control methods throw an exception if an error occurs so we will use an On Error statement


Dim objMailer 'Mailer control
on error resume next
'create instance of Mailer control
Set objMailer = Server.CreateObject("Dundas.Mailer")
sendemail = (trim(request.Form("email")))
'set Mailer control properties and collection items
objMailer.TOs.Add sendemail
objMailer.FromAddress = sendemail
objMailer.Subject = (request.Form("first_name")&"'s"&" account details")
'specify an SMTP Relay server. This increases the speed and reliability of the operation
objEmail.SMTPRelayServers.Add "SomeSmtpServer.com"


objMailer.Body = "Hi "'has been edited by me
'send email
objMailer.SendMail
'you can test for the success/failure of the operation by examining VBScript's Err object here
'test for success/failure
If Err.Number <> 0 Then
'an error occurred so output error message
'Response.Write "Sorry, the following error occurred: " & Err.Description
Else
'success!
Response.Write "The html email was successfully sent."
End If

Set objMailer = Nothing

%>
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-15 : 01:56:53
[code]<%
'most control methods throw an exception if an error occurs so we will use an On Error statement


Dim objMailer 'Mailer control
on error resume next
'create instance of Mailer control
Set objMailer = Server.CreateObject("Dundas.Mailer")
sendemail = (trim(request.Form("email")))
'set Mailer control properties and collection items
objMailer.TOs.Add sendemail
objMailer.FromAddress = sendemail
objMailer.Subject = (request.Form("first_name")&"'s"&" account details")
'specify an SMTP Relay server. This increases the speed and reliability of the operation
objEmail.SMTPRelayServers.Add "SomeSmtpServer.com"


objMailer.Body = "Hi "'has been edited by me
'send email
objMailer.SendMail
'you can test for the success/failure of the operation by examining VBScript's Err object here
'test for success/failure
If Err.Number <> 0 Then
'an error occurred so output error message
'Response.Write "Sorry, the following error occurred: " & Err.Description
Else
'success!
Response.Write "The html email was successfully sent."
End If

Set objMailer = Nothing

%>[/code]

am reading through the code and wondering if thats where the error is above in red ?
Also am wondering if there are any other things, i am not doing right in the above code ???

Thanks Guys for your assistance
Ehi

Go to Top of Page

jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2006-02-15 : 08:48:16
I just re-read your first email more carefuly, and noticed that when sending email with Dundas, hotmail still rejected it. I thought it did work with Dundas, and then not with CDO, so it was a configuration issue on your part. But it is NOT.

You do understand that it has nothing to do with what library you are using, they all do the same thing -- it has to do with SPAM controls that hotmail uses ... right? The very first step is trying to get you to realize this (as Merkin has been trying to do for a while).

Did you get an "Undeliverable" email sent to you regarding the failure from your SMTP server? What did it say? Is your SMTP server configured to send Undeliverable reports to you so you can read them? If not, set it up so it does and resend an email to Hotmail and let us know what it says.
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-15 : 17:53:36
>>I thought it did work with Dundas, and then not with CDO
Works well with dundas (but no delivery to hotmail), but not CDO yet. the smtp config was definitely wrong.

Am testing and talking with our providers again, would certianly give you a feedback.
oh, i do appreciate your advice.
Afrika
Go to Top of Page

karuna
Aged Yak Warrior

582 Posts

Posted - 2006-02-15 : 23:06:26
Afrika,

If there is a problem only delivering to Hotmail then, as Merkin & JSmith says I dont see a problem with the code. It has to be a problem with the providers SMTP.

Anyways for CDO you can refer the following two links for sending mails.

http://support.microsoft.com/?id=286431 - This article talks about sending mail using a Remote SMTP Server
http://support.microsoft.com/kb/286430/EN-US/ - This one using the local server
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q302839 - This will help to add a delivery status notification.

I would use the third option to see whether my mail is getting delivered or getting lost somewhere else.

Thanks

Karunakaran
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-16 : 01:17:42
yeah,
Thanks Karunakaran, as said above am testing, i would also have a look at the resources specified, Gracia mon ami(s)

Ehi
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-02-16 : 11:07:01
i'm just at the begining of the end of developing a library that uses WEBDAV to communicate to exchange.
hotmail also supports it AFAIK.
the cool thing about it is that is uses http protocol and xml to comunicate.
so it can go through places cdo can't
like firewalls and such.
the thing that bothers most people is that it's not an API but a HTTP protocol extension.
at the begining i thought what the hell am i doing developing this... but the more i got into it the more i liked it.


Go with the flow & have fun! Else fight the flow
Go to Top of Page

afrika
Master Smack Fu Yak Hacker

2706 Posts

Posted - 2006-02-17 : 04:01:32
Mladen,
I$ this open source or do its have a licen$ing agreement ?

What am trying to $ay, is it FREEEEEEEEEEEEEEEEEEEE ????

I am acutally out of town, should be back sunday and continue testing from were i stopped
Go to Top of Page
    Next Page

- Advertisement -