Note: You must be registered in order to post a reply. To register, click here. Registration is FREE! Before posting, make sure you have read this topic!
T O P I C R E V I E W
mark_laverty
Posted - 03 October 2011 : 07:04:04 Hi!
First off, thank you for taking the time to read this. You help is much appreciated :-)
Set objNewMail = Server.CreateObject("CDO.Message") Set objNewMail.Configuration = iConf
'Format and send message Err.Clear
objNewMail.To = strRecipients objNewMail.From = strSender objNewMail.Subject = strSubject objNewMail.TextBody = strMessage On Error Resume Next objNewMail.Send
If Err <> 0 Then Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>" End if
Set objNewMail = Nothing
on error goto 0 %>
If I run the testemailcomponent.asp page it shows that cdo is available (its the only one is shows as being avalable).
If I try to use the sendmail function when looking at a users profile it says that the message was sent, but the email never arrives.
If I try to register a new user then they dont recieve the confirmation email to the email address that they entered.
I am 99% sure that the SMTP details I have entered are correct. I can send and recieve email from this account using Outlook with the same settings.. any sugestions?
8 L A T E S T R E P L I E S (Newest First)
Podge
Posted - 03 October 2011 : 10:24:31 Glad you got it working.
mark_laverty
Posted - 03 October 2011 : 10:01:06
quote:Originally posted by Podge
Are you sure that strMailServer is set correctly? Try hardcoding it or entering the i.p. address.
Ok.. fixed it.. BUT I'm not 100% sure how.
I tweaked the script.. set the strmailserver to "localhost", deleted and re-created the mail account I am using and re-created it without a leading "_" in the password as the hosting providers site didnt seem to like that.
Here's the script as it is on the website now..
<% if trim(strFromName) = "" then strFromName = strForumTitle end if Set iConf = Server.CreateObject ("CDO.Configuration") Set Flds = iConf.Fields
If Err <> 0 Then Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>" End if Set objNewMail = Nothing on error goto 0 %>
So that seems to work great and I now have emails flowing even to external domains
Thank you very much for your help
Podge
Posted - 03 October 2011 : 09:23:59 Are you sure that strMailServer is set correctly? Try hardcoding it or entering the i.p. address.
mark_laverty
Posted - 03 October 2011 : 08:52:21 Interestingly if I change use SSL to 'True' then I get this message...
CDO.Message.1 error '80040213'
The transport failed to connect to the server.
/forum/inc_mail.asp, line 30
If I set it back to False then I get the previous message again. I guess that means that at least it is trying to connect to the server and failing as opposed to not even trying.
mark_laverty
Posted - 03 October 2011 : 08:47:58 Ok, script changed... I now get this..
"Send an E-MAIL Message
error '80040211' /forum/inc_mail.asp, line 30 "
Heres the script exactly as it is on the server (with the exception of the 'xxxx's to not disclose sensitive information.
<% if trim(strFromName) = "" then strFromName = strForumTitle end if Set iConf = Server.CreateObject ("CDO.Configuration") Set Flds = iConf.Fields
Set objNewMail = Server.CreateObject("CDO.Message") Set objNewMail.Configuration = iConf
'Format and send message Err.Clear objNewMail.To = strRecipients objNewMail.From = strSender objNewMail.Subject = strSubject objNewMail.TextBody = strMessage On Error goto 0 objNewMail.Send If Err <> 0 Then Err_Msg = Err_Msg & "<li>Your request was not sent due to the following error: " & Err.Description & "</li>" End if Set objNewMail = Nothing on error goto 0 %>
Podge
Posted - 03 October 2011 : 08:29:02 Try changing this
On Error Resume Next
objNewMail.Send
to this
On Error goto 0
objNewMail.Send
and then try to send an email. Post any error here.
mark_laverty
Posted - 03 October 2011 : 07:47:49
quote:Originally posted by Podge
Does your host have any code samples for sending email? Or any instructions at all?
Nothing that I have found.. BUT I do use .net in an aspx page to send mail from webforms on the root site..
Dim msg As New MailMessage Dim emailClient As New SmtpClient("localhost", 25) Dim SMTPUserInfo As New System.Net.NetworkCredential("xxxxxx@mltek.co.uk", "xxxxxxx") Dim FromAddress As New System.Net.Mail.MailAddress("xxxxxx@mltek.co.uk") msg.To.Add("xxxxxx@mltek.co.uk") msg.From = FromAddress emailClient.UseDefaultCredentials = False emailClient.Credentials = SMTPUserInfo