Click here to Skip to main content
15,897,519 members
Please Sign up or sign in to vote.
1.50/5 (4 votes)
See more:
Hi

I currently have a program that runs an import of users that need to be added to the system once the username and password are generated I need to send the URL link as well as username and password to the users.

this is the code i currently have


VB
Dim Statement As New MailMessage
                            Dim EmailAdd As String = "Test@email.com"
                            'Dim emailaddress2 As String = sFieldsIn(6).ToString

                            Statement.Subject = "Login details"
                            'Statement.To.Add(emailaddress2)
                            Statement.To.Add(EmailAdd)
                            Statement.Bcc.Add("Test2@email.com")
                            Statement.From = New MailAddress("No-Reply@Test.com")


                            Statement.Body = "Please click the following link and enter the user details below to access your profile" & vbCrLf & "URL:" & System.Configuration.ConfigurationSettings.AppSettings("URL") & vbCrLf & "UserName:" & username & vbCrLf & "Password:" & Password


                            Dim SMTP As New SmtpClient("mail.SMTP.com")

                            SMTP.Credentials = New System.Net.NetworkCredential("Username", "Password")
                            SMTP.Port = CInt("25")
                            SMTP.Send(Statement)


When the email gets sent it either gets flagged as spam or it is blocked and i do not receive the mail.(i have tested sending this to a gmail and live email addresses)

Please could you assist

Thank you in advance
Posted
Updated 15-Sep-14 21:01pm
v2
Comments
Pikoh 16-Sep-14 3:30am    
do you add as "from" email "No-Reply@Test.com" or a real email address? Maybe if "from" email doesn't exists that could make it be flagged as spam
isi19 16-Sep-14 3:34am    
The Email address does not exist,i will try using one that does exist and see if it works.
BillWoodruff 16-Sep-14 12:07pm    
If you are sending an e-mail with the UserName and Password in plain-text, aren't you taking a great risk ?

You code is not the issue here. What is the issue is the content you are sending and the email its coming from. For example, if you use a hotmail account to send mail from your application and if your application has badly written text in it or does not explain its purpose as to why the user is being sent it, the receiving end will block it and flag it as spam.

You'd have more chance of your message reaching the sender if you provide a small explanation for the purpose of the email you are sending and then the credentials if any. You would also be better to use a legitimate domain name to send the mails from, such as yourdomain.com.

If you just send a bunch of credentials without a short explanation for what the email is for, it too will be flagged as spam. If an email is flagged as spam, its because of the filters used on the receiving end of the users application. I don't advise trying to trick the email client as your mail could then be seen as malicious and that's worst.
 
Share this answer
 
v2
The problem is not directly related to your code. The receiving part of software classifies it as spam using some criteria or algorithm. You can ask them to change it, or, say, to the sender address to the while list, or something like that.

It's better to deny any attempts to trick the system (which is usually possible, but why?)...

—SA
 
Share this answer
 
Comments
isi19 16-Sep-14 3:32am    
So i should ask them to save the email address that it is being sent from to the while list?
Sergey Alexandrovich Kryukov 16-Sep-14 9:33am    
Whatever they can do.
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900