Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Is this this programming correect for emailing?

Posted on 2005-05-10
8
Medium Priority
?
180 Views
Last Modified: 2010-04-17
Set oRS = Nothing      

            MailText = MailText & "<br><br>This email was sent as a system test .<br>"
            MailText = MailText & "Please contact REB for further details, or to be removed from the email list<br>"

            MailText = MailText & "</body></html>"
            If Not(MailTo = "")Then
                  Set EmailAlert = CreateObject("Outlook.Application")
                  Set EmailNameSpace = EmailAlert.GetNameSpace("mapiprofilename")
                  Set MailIitem = EmailAlert.CreateItem(0)
                        'MailItem.Recipients.Add MailTo
                        MailItem.Recipients.Add "gps@****.com"
                        MailItem.Subject = "PPCMS"
                        MailItem.HTMLBody = MailText
                        MailItem.Send
                  EmailNameSpace.Logoff
            End If
            MailTo = ""
            MailText = ""

      Next

Is this the correct scripting for using a mapi profile on a sql server? - it seems to run fine but doesnt seem to send any email!!

any help would be greatfully received..

Grant.
0
Comment
Question by:backoffice
  • 4
  • 2
6 Comments
 
LVL 12

Expert Comment

by:Preece
ID: 13973233
-  There was a time when I worked on a vb6 app that had a send mail feature.  We used sql server as you are, but we also had to have Outlook installed on the sql server and configured to accept requests from sql svr.  We did have issues where the pending "sent" emails would queue up in Outlook and Outlook would not send them right away.  We would need to manually go in and send them....

-  Also, it seems that you may need to provide more complete html in your MailText.  This:

          MailText = MailText & "<br><br>This email was sent as a system test .<br>"
          MailText = MailText & "Please contact REB for further details, or to be removed from the email list<br>"

          MailText = MailText & "</body></html>"

may need to look more like:

          MailText = MailText & "<html><head></head><body>"
          MailText = MailText & "<br><br>This email was sent as a system test .<br>"
          MailText = MailText & "Please contact REB for further details, or to be removed from the email list<br>"

          MailText = MailText & "</body></html>"

Preece
0
 

Author Comment

by:backoffice
ID: 13976662
I have got outlook installed on the server. and if i do a test email from outlook itr works fine... BUT it does not seem to accept email rom sql server... what settigs do i have to change to allow outlook to accept email from sqlserver?
0
 
LVL 12

Expert Comment

by:Preece
ID: 13979882
What versions of:

OS:
SQL Server:
Outlook:

Preece
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:backoffice
ID: 13979920
OS win 2000
SQL 2000 + sp3a
Outlook 2000

when i test sql mail i get the following error:

error 18025 xp_test_mapi_profile failed with mail error 0x80040111

i have checked the mapi name and it is correct and i have sent a test email from outlook to myself..

When i type in the name of the profile i get the messaage that it isnt found on this computer BUT i assure you the profile is there and it is the correct name...

any suggestions..?
0
 
LVL 12

Accepted Solution

by:
Preece earned 2000 total points
ID: 13980023
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn different types of Android Layout and some basics of an Android App.
Six Sigma Control Plans
Progress

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question