Not sending?

Robse

Guppy
Hi, this is the code I use for sending email:

Code:
Dim Mail1 As System.Web.Mail.MailMessage
Mail1 = new System.Web.Mail.MailMessage()

Mail1.From = "[email protected]"
Mail1.To = "[email protected]"
Mail1.Subject = "Subject"
Mail1.Body = "Body"

Try
    System.Web.Mail.SmtpMail.Send(Mail1)
Catch Exc As Exception
    Response.Write(Exc.Message)
End Try

It doesn't throw an error but the message isn't sent.
What am I doing wrong?
 
Robse said:
Hi, this is the code I use for sending email:

Code:
Dim Mail1 As System.Web.Mail.MailMessage
Mail1 = new System.Web.Mail.MailMessage()

Mail1.From = "[email protected]"
Mail1.To = "[email protected]"
Mail1.Subject = "Subject"
Mail1.Body = "Body"

Try
    System.Web.Mail.SmtpMail.Send(Mail1)
Catch Exc As Exception
    Response.Write(Exc.Message)
End Try

It doesn't throw an error but the message isn't sent.
What am I doing wrong?

Somewhere before the Send, specify the smtp server with your domain name:
Mail1.SmtpServer = "mail.yourdomain.com"

riley
 
OK I changed my code to this:
Code:
Dim Mail1 As System.Web.Mail.MailMessage

Mail1 = new System.Web.Mail.MailMessage()
Mail1.From = "[email protected]"
Mail1.To = "[email protected]"
Mail1.Subject = "Subject"
Mail1.Body = "Bodytest tes "

System.Web.Mail.SmtpMail.SmtpServer = "mail.mydomain.jodoshared.com"                

try
System.Web.Mail.SmtpMail.Send(Mail1)
catch exc as exception
response.write(exc.Message)
end try

Now I get the error:

Could not access 'CDO.Message'
 
Robse said:
OK I changed my code to this:
Code:
Dim Mail1 As System.Web.Mail.MailMessage

Mail1 = new System.Web.Mail.MailMessage()
Mail1.From = "[email protected]"
Mail1.To = "[email protected]"
Mail1.Subject = "Subject"
Mail1.Body = "Bodytest tes "

System.Web.Mail.SmtpMail.SmtpServer = "mail.mydomain.jodoshared.com"                

try
System.Web.Mail.SmtpMail.Send(Mail1)
catch exc as exception
response.write(exc.Message)
end try

Now I get the error:

Could not access 'CDO.Message'

Sorry, I didn't examine the code closely enough. I think you need a reference to the SmtpMail object. The following code is basically the same as what I am using on my sites:

Code:
Dim Mailer as System.Web.Mail.SmtpMail
Dim Mail1 As System.Web.Mail.MailMessage
Mail1 = new System.Web.Mail.MailMessage()

Mail1.From = "[email protected]"
Mail1.To = "[email protected]"
Mail1.Subject = "Subject"
Mail1.Body = "Body"

Try
    Mailer.SmtpServer = "mail.mydomain.com"
    Mailer.Send(Mail1)
Catch Exc As Exception
    Response.Write(Exc.Message)
End Try

riley
 
Sorry, I had some custom Exception Handlers, the real error seems to be this:

The server rejected one or more recipient addresses. The server response was: 553 sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)

This seems to be a problem with POP before SMTP? Do I have to change some email settings?
 
This is really easy script I use with asp. CDONTS is supported with Jodo and doesn't need any smtp server specified.

Here's the code:

<%
Dim MyBody
Dim MyCDONTSMail
%>

<%
Set MyCDONTSMail = CreateObject("CDONTS.NewMail")
MyCDONTSMail.From= "[email protected]"
MyCDONTSMail.To= "[email protected]"
MyCDONTSMail.Subject="This is a Test"
MyBody = "Thank you" & vbCrLf
MyBody = MyBody & "email text here" & vbCrLf
MyBody = MyBody & "second line of email text"
MyCDONTSMail.Body= MyBody
MyCDONTSMail.Send
set MyCDONTSMail=nothing
%>
 
Robse said:
Sorry, I had some custom Exception Handlers, the real error seems to be this:

The server rejected one or more recipient addresses. The server response was: 553 sorry, that domain isn't allowed to be relayed thru this MTA (#5.7.1)

This seems to be a problem with POP before SMTP? Do I have to change some email settings?

I can only suggest that either the To or From must be a valid mailbox at yourdomain.com. Also, the server should be mail.yourdomain.com and the domian specified in the To or From must be the same as the servername.

riley
 
Use "localhost" for your server. I got that problem intermittently when I was using mail.mydomain.net, but changing to localhost took care of it.
 
Now the error is gone but the mail never makes it. I also checked the SPAM directory.

Thanks guys I'm gonna open up a ticket maybe they know what's wrong
 
the following will help you use cdosys with smtp auth

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdosys/html/_cdosys_fields.asp

one will need items similar to this in their asp script (ignore that the forum says this is PHP it is ASP)
PHP:
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.yourdomain.com"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item ("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1 'THIS MUST BE SET TO 1 TO ENABLE SMTP AUTH
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = '[email protected]" 'YOUR EMAIL USERNAME
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = "secretpassword" 'YOUR EMAIL PASSWORD
 
As far as I know use:

1) localhost as server

2) a valid jodohost email address (ie one that you setup for your domain in jodohost) otherwise use CDONT's
 
I edit my post with some CDOSYS sample, and please try to use CDOSYS, not CDONTS, CDONTS is legacy and not supported software. :D

CDOSYS has all the features of CDONTS plus some, and on of those is being SMTP Auth.
 
Hey thanks for your repies, I didn't expect to here from anyone tonight. I feel like i'm going crazy because it just started working and I didn't change anything. I wonder if there was just a few mins when the server wasn't working right... Oh well it works now so thats what i care about.

Thanks.
 
If you are sending a significant volume of email from our mail server, you'd need to fill out the mass-mailing form to ensure mass-mailing restrictions on your domain are removed
 
What is a "significant volume of email"? I'm using a portal script with forums and reply notifications and things like that.
 
50 emails/day per mailbox is the current restriction if you use mail.yourdomain.com as SMTP server. You need to fill out the form to have this removed.

If you use localhost as SMTP server, no restriction.
 
Guys,

Your SMTP server doesn't allow to send outbound email to any other email address since you haven't given the user id and password. Try to send to some valid email id on the same domain and it works just fine. For e.g. from address is "[email protected]" and to address is "[email protected]". I just tried your code and worked for me.
 
Back
Top