Forum Moderators: open

Message Too Old, No Replies

Using Jmail

         

ColinJ

7:42 am on Jan 16, 2003 (gmt 0)

10+ Year Member



I wonder if someone could check this for me

Im new to ASP, Im having trouble with Jmail.

I have written this sub.

Sub sendMail( paramTo, paramFrom, paramSubject, paramEmailBody )

Dim JMail
Set JMail = Server.CreateObject("JMail.SMTPMail")

'Below you should enter your own SMTP-server
JMail.ServerAddress = "smtp-au.server-mail.com"
JMail.Sender = paramFrom
JMail.ISOEncodeHeaders = false
JMail.ContentTransferEncoding = "8bit"
JMail.Subject = paramSubject
JMail.AddRecipient paramTo
JMail.Body = paramEmailBody
JMail.Priority = 1
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.Execute

set JMail = nothing

End Sub

And I call it by

Dim emailListAdmin
emailListAdmin = "coljohnstone@hotmail.com"
'emailListAdmin = "brian@funnel-web.com.au"

'send email to Administrator to advise successful registration

Dim toAddress
Dim fromAddress
Dim subject
Dim emailbody

toAddress = emailListAdmin
fromAddress = "bcs@funnel-web.com.au"
subject = "HP Infrastructure Masterclass Successful Registration"

emailBody = ""
emailBody = emailBody & "Registration successful for :-" & VbCrLf
emailBody = emailBody & VbCrLf
emailBody = emailBody & " " & dictFields.Item("FirstName") & " " & dictFields.Item("LastName") & VbCrLf
emailBody = emailBody & VbCrLf

sendMail toAddress, fromAddress, subject, emailBody

Have I done the right thing?

It works once when called on subsequent calls it fails.

Any help appreciated
Thank You
Colin

wardbekker

8:04 am on Jan 16, 2003 (gmt 0)

10+ Year Member



Hi ColinJ,

Could you show us the error?

ColinJ

8:06 am on Jan 16, 2003 (gmt 0)

10+ Year Member



Could the host have set a rule such that if the from address is not a valid email address of the domain then it won't send

wardbekker

8:21 am on Jan 16, 2003 (gmt 0)

10+ Year Member



That's very possible. Check if a mail send from an adress from the smtp server's 'main' domain will be transmitted ok.

ColinJ

9:17 am on Jan 16, 2003 (gmt 0)

10+ Year Member



I have confirmed with the host that the email from address could be anything, further testing proves this but...

I have 3 email accounts, hotmail, my isp, and work is it possible that my isp email account and my work account could block emails from email addresses that are not valid e.g "HewlettPackardAustralia" but accept email addresses that look valid to the eye but aren't valid

Krapulator

11:24 am on Jan 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



 

wardbekker

5:06 pm on Jan 16, 2003 (gmt 0)

10+ Year Member



ColinJ,

Always use a valid e-mail format as the from property. So imaginarysender@example.org is ok, but imaginarysender isn't.