Sending e-mails in ASP

10 replies
I got this script from one ASP tutorial (click here to see it):

<%
Set myMail=CreateObject("CDO.Message")
myMail.Subject="Sending email with CDO"
myMail.From=mymail@mydomain.com
myMail.To=someone@somedomain.com
myMail.TextBody="This is a message."
myMail.Sendset
myMail=nothing
%>

replaced mymail@mydomain.com and someone@somedomain.com with
2 mail addresses of two mail-boxes that I have on www.yahoo.com and
uploaded this script (as an .asp file) on a free asp-supported remote
server. Then I tried to open the link to this file in my web browser (IE6) -
nothing happened (only got an HTTP 500 page) - and when I checked
my mailbox, I didn't find any new e-mail there. What did I do wrong or
what did I not do?
#asp #emails #sending
  • Profile picture of the author johnbelly
    Banned
    it better to find in codeproject.com its really helpful
    {{ DiscussionBoard.errors[355577].message }}
    • Originally Posted by johnbelly View Post

      it better to find in codeproject.com
      thanks for this link. I'll be sure to ask there, too.
      {{ DiscussionBoard.errors[358934].message }}
  • Profile picture of the author Jenniferlinn
    Banned
    Try this code:

    <%@ LANGUAGE="VBSCRIPT" %>
    <HTML>
    <HEAD>
    <TITLE>ASP Email - Send a Simple Plain-Text Email</TITLE>
    </HEAD>
    <BODY>

    <%
    ' Create a mailman
    set mailman = Server.CreateObject("Chilkat.MailMan2")

    ' Any unlock code begins the 30-day trial.
    mailman.UnlockComponent "unlock_code"

    ' Tell the mailman where the SMTP server is located
    mailman.SmtpHost = "smtp.mymailserver.com"

    ' Some SMTP servers require a login/password
    'mailman.SmtpUsername = "myLogin"
    'mailman.SmtpPassword = "myPassword"

    ' Create an Email message
    set email = Server.CreateObject("Chilkat.Email2")

    ' Enter the recipient's information
    email.AddTo "John Smith", "support@chilkatsoft.com"

    ' Enter the sender's information
    email.FromName = "Joe Smith"
    email.FromAddress = "joe.smith@somedomain.com"

    ' Enter the email subject
    email.Subject = "Simple plain-text email"

    email.Body = "This is a test"

    ' Sends the email with the patterns replaced.
    if mailman.SendEmail(email) then
    Response.write "Message sent successfully!<br><br>"
    else
    Response.write mailman.LastErrorHtml
    end if

    Set email = Nothing
    Set mailman = Nothing

    %>

    </BODY>
    </HTML>
    {{ DiscussionBoard.errors[370139].message }}
    • Hello, Jenniferlinn!

      I tried your code on two different free asp-supporting
      hosts and in both cases I was getting the same error
      message:

      Server objecterror 'ASP 0177 : 800401f3'
      Server.CreateObject Failed
      ..., line 10
      800401f3


      Line 10 is this line in your code:

      set mailman = Server.CreateObject("Chilkat.MailMan2")

      It looks like the object cannot be created here. Why
      is it so?
      {{ DiscussionBoard.errors[371015].message }}
  • Profile picture of the author Sleaklight
    Because you don't have Chilkat on your server so it can't create something out of something that doesn't exist.
    {{ DiscussionBoard.errors[371469].message }}
    • Originally Posted by Sleaklight View Post

      Because you don't have Chilkat on your server so it can't create something out of something that doesn't exist.
      I see, thank you. Is there any way for me to get this "Chilkat" and place it on my server (which is a free one). Will a free server allow me to do that?
      {{ DiscussionBoard.errors[371531].message }}
  • Profile picture of the author Sleaklight
    You have to ask your host if they are willing to install that component. Most are reluctant to install components.
    {{ DiscussionBoard.errors[371637].message }}
  • Profile picture of the author rwil02
    Originally Posted by truckload-of-thoughts View Post

    I got this script from one ASP tutorial (click here to see it):
    nothing happened (only got an HTTP 500 page) - and when I checked
    my mailbox, I didn't find any new e-mail there. What did I do wrong or
    what did I not do?
    Go into internet options, advanced and disable "friendly http errors"
    then you will get an actual error message from the server instead of the IE error message.
    Signature

    Roger Willcocks
    L-Space Design
    Please vote to help me win a 3kW solar array

    {{ DiscussionBoard.errors[376097].message }}

Trending Topics