Link to home
Start Free TrialLog in
Avatar of Aanvik
Aanvik

asked on

ASP Email Question

I am using this following code to send email via classic asp.

It all works fine if I use the correct mailFrom... but In case I change the fromEmail, it doesn;t work. I need to send invites in my application and the from email should be the agents email address and not my site's email address. Is there any way I can change it>

		Sub sendEmail(mailFrom, mailTo, mailSubject, mailMessage, mailServer, mailUsername, mailPassword)
			Set MyMail = CreateObject("cdo.message")
			MyMail.From = mailFrom
			MyMail.To = mailTo
			MyMail.Subject = mailSubject
			MyMail.HTMLBody = mailMessage
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = mailServer
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = mailUsername
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = mailPassword
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
			MyMail.Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
			MyMail.Configuration.Fields.Update
			MyMail.Send
			Set MyMail = nothing
		End Sub

Open in new window

Avatar of oleggold
oleggold
Flag of United States of America image

the problem is most possible with mail server/smtp configuration that set up so check mailFrom is originated on the site , admin should change it to be able to orginate elsewhere
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Many web hosts will not allow you to send from an email address that does not exist on your account.  That's considered to be sending spam.