Solved

ASP Email Question

Posted on 2012-04-04
3
281 Views
Last Modified: 2012-04-07
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

0
Comment
Question by:Aanvik
3 Comments
 
LVL 21

Expert Comment

by:oleggold
ID: 37808288
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
0
 
LVL 30

Accepted Solution

by:
Wayne Barron earned 500 total points
ID: 37808306
I use "Google Apps" as my Hosting provider has a screwed up mail server setup that everything gets marked as spam.

So.
With Google Apps, I have to assign the account that is used in my Mail Forms, as "Administrator". If it is a basic account, it will not work.

I am unsure what mail hosting you are using, but if you have a way of making the accounts as "Administrator" then give it a shot, and try the mail again.

Good Luck
Carrzkiss
0
 
LVL 82

Expert Comment

by:Dave Baldwin
ID: 37808701
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.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
This process describes the steps required to Import and Export data from and to .pst files using Exchange 2010. We can use these steps to export data from a user to a .pst file, import data back to the same or a different user, or even import data t…
In this video we show how to create an Address List in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Organization >> Ad…
This video discusses moving either the default database or any database to a new volume.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now