Delayed receiving the email message using the SMTP server - email

I already deployed the Email Service I developed on the Chicago Server. Last Friday 11:30pm in Philippine time, I tested the sending and it run's properly, but when I checked my email there's no message in inbox or spam. And then, Saturday 1:30am, I've noticed that I received the message that I tested last Friday.
Please advice me guys! thanks!
My Questions is:
a.) Do I need to configure something on the Server to make the real time receiving on emails?
here's my code:
//send email
MailMessage objEmail = new MailMessage(new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()), new MailAddress(ConfigurationManager.AppSettings["emailAdd"].ToString()));
objEmail.Subject = "Test";
objEmail.Body = "CODE:" + _Message;
objEmail.Priority = MailPriority.High;
SmtpClient SmtpMail = new SmtpClient();
SmtpMail.Host = "localhost";
SmtpMail.Send(objEmail);

Put this one on your code:
SmtpMail.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;
And also, configure the relay restrictions on the SMTP server that will allow your 120.0.0.1/localhost..
Last, configure the firewall and port forwarding on the server.
I hope this will help you..

Related

Mail Session settings at Websphere Server

The mails are sent with default From address as wasadm#servername which I want to change. I tried using the property mailFrom at application.inf file, changed the values at websphere console - Resources >> Mail >> Mail Sessions >> Return e-mail address but nothing worked out.
Could you please let me know if you have some solution to replace the default from mail address to a custom value.
Normally, the email-sending application code sets a "from" address in the message itself.
That said, I think it might work to set a Mail Session Custom property of mail.from. According to https://javaee.github.io/javamail/docs/api/overview-summary.html:
mail.from The return email address of the current user, used
by the InternetAddress method getLocalAddress.
I know from experience that the envelope sender address can be set with Custom property mail.smtp.from. See https://javaee.github.io/javamail/docs/api/com/sun/mail/smtp/package-summary.html
mail.smtp.from Email address to use for SMTP MAIL command. This sets the envelope
return address. Defaults to msg.getFrom() or
InternetAddress.getLocalAddress(). NOTE: mail.smtp.user was previously
used for this.

Send email via MATLAB

I need to send an email via MATLAB and I've read the instructions for sendmail and lots of answers around here. I've tried 3 email providers and I can't really use any of them:
Gmail: I can only send email when I deactivate my anivirus
Hotmail and Yahoo: Error using sendmail (line 171) Exception reading response; Connection reset
Hotmail and Yahoo (antivirus off): Error using sendmail (line 171) Exception reading response; Unrecognized SSL message, plaintext connection?
Here's the code
mail = 'user#service.com';
password = 'passwordgoeshere';
setpref('Internet','SMTP_Server','smtp.server.com');
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port',port);
sendmail(mail,'Test from MATLAB','Hello! This is a test from MATLAB!')
I've used the following variables:
Gmail: smtp.gmail.com port=465
Hotmail: smtp.live.com port=465 and port=587
Yahoo: smtp.mail.yahoo.com port=587
Since deactivating the antivirus is not a good option, can anyone help me solving this?
Thank you
An alternative way on linux is to run a command line that send the email.
unix('echo "message" | mail -s "subject" example#gmail.com');
A similar method should be available for windows.
For Gmail
Change your settings to allow less secure apps to access your account. Go to the "Less secure apps" section in My Account.
Next to "Access for less secure apps," select Turn on. (Note to Google Apps users: This setting is hidden if your administrator has locked less secure app account access.)
In Matlab:
mail = 'user#otherdomain.com';
password = 'myPassword';
% Set up the preferences
setpref('Internet','E_mail',mail);
setpref('Internet','SMTP_Server','smtp.gmail.com');
setpref('Internet','SMTP_Username',mail);
setpref('Internet','SMTP_Password',password);
% The following is necessary only if you are using GMail as
% your SMTP server.
props = java.lang.System.getProperties;
props.setProperty('mail.smtp.auth','true');
props.setProperty('mail.smtp.socketFactory.class', 'javax.net.ssl.SSLSocketFactory');
props.setProperty('mail.smtp.socketFactory.port','465');
subject = 'Test subject';
message = 'Test message';
sendmail(mail,subject,message)
Simply declare
mail = 'user';
Drop the extension #service.com for the variable mail.

Exchange 2010 Authentication Issues

So I am trying to send an automated message from an Excel VBA backend. I'm very competent in my VBA skills and have used the method below with great success in the past. I am having issues using this method in my new environment and I know it has something to do with the configuration of the Exchange server, the issue is that the guy who manages the exchange server nor I are Exchange experts.
Public Function SendEmail(
txtTo As String,
txtSubject As String,
txtBody As String,
Optional txtSender As String = vbNullString,
Optional txtCC As String = vbNullString,
Optional txtBCC As String = vbNullString)
Dim objMsg As Object, objconfig As Object, objFields As Object
Set objMsg = CreateObject("CDO.Message")
Set objconfig = CreateObject("CDO.Configuration")
Set objFields = objconfig.fields
'Set the email configuration
With objFields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "SMTP"
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
'Apply the various fields to the email object
With objMsg
.Configuration = objconfig
.From = txtSender
.Subject = txtSubject
.To = txtTo
.Cc = txtCC
.Bcc = txtBCC
.TextBody = txtBody
.Send
End With
SendEmail = IIf(Err.Number = 0, True, False)
'clean up
Set objMsg = Nothing
Set objconfig = Nothing
Set objFields = Nothing
End Function
I am attempting to send to a distribution group which requires authentication. We've figured out how to remove that "feature" to send an email but this is not ideal. I've tried using basic/clear trust (1) for the authentication method, supplied my username and password to the required fields in the configuration object and still no dice. When I send an email from Outlook I have no issues sending to an email that requires authentication, but when using CDO Exchange won't allow me to authenticate. It also never resolves the sender address, not sure if that is related or not but for the sake of full disclosure there it is.
I know that the Exchange/SMTP server is configured to allow for anonymous sending, but that seems to be the only option that CDO will use.
I'm at my wits end. Any Exchange gurus out there that might be able to offer some suggestions?
Thanks,
Chad
Well, I finally managed to solve my own issue. If anyone else is having similar issues I thought I'd share. It turned out to be a port issue.
The standard ports for exchange are 25 and 465 for SSL (I believe).
In this instance, port 25 was configured for sending anonymously from behind our firewall (by printers & fax machines mainly). I tried using port 465 but it reported back that the port did not exist.
After much digging on the exchange server I found that some arbitrary port number was used to configure the authenticated messages against. Once I hardcoded the correct port number in the code above, I had no issues getting it to work. Happy coding!

Coldfusion not sending email

I am having problems with this website, it isn't sending any emails. Basically when someone places a order, it sends a comfirmation email. I don't see any problems with the code but I believe this is the right place to be looking for the problem. Can some one help me please?
<cfquery name="getUser" datasource="personal2009">
SELECT * FROM site_users WHERE id = '#session.id#'
</cfquery>
<cfoutput>
<cfmail to="#site_email#" from="#site_email#" subject="Website International Order Request">
#getUser.title# #getUser.Firstname# #getUser.Surname# has requested to deliver an order to an international address.
Their contact details are:
#getUser.Address1#
#getUser.Address2#
#getUser.Town#
#getUser.Postcode#
#getUser.Country#
#getUser.Tel#
#getUser.email#
The delivery address requested is:
#formtitle# #formFirstname# #formSurname#
#formAddress1#
#formAddress2#
#formTown#
#formPostcode#
The order details are:
<cfset thisrow = 0><cfoutput><cfset thisrow = thisrow + 1><cfset tot = 0><cfloop index="list" from="1" to="#session.numincart#"><CFQUERY NAME="ind" DATASOURCE="personal2009" maxrows=1>SELECT * FROM products WHERE id = #listgetat(session.cart, list)#</CFQUERY>
Product Name: #ind.product_name#
Price: £#decimalformat(listgetat(session.price, list))#<cfset multiply2 = #listgetat(session.quant, list)#>
Quantity: #listgetat(session.quant, list)#
</cfloop></cfoutput>
Thank you
</cfmail>
</cfoutput>
<cfset session.endemail = '1'>
Depending on what your hosting environment looks like, I may suggest altering your cfmail tag to the following:
<cfmail to="#site_email#" from="#site_email#" subject="Website International Order Request" server="#server#" username="#username#" password="#password#">
1) If you don't have access to the CFADMIN, you are unable to track your mail path. Specifying your own server/username/password will allow you to send email with your own SMTP server and rule that out.
2) Even if your host has CFMAIL setup with a SMTP default server, it may be possible that they have not setup SMTP relaying correctly. The outcome is your mail gets sent through coldfusion but rejected by the smtp server.
3) Even if your host has CFMAIL setup and SMTP relaying setup, the last possibility could be SPAM filters on the receiving end. If you have SPAM filters that look at SPF/Domain Keys/other criteria, they could be blocking to emails too.
Specifying your own server/username/password is usually the best bet to troubleshooting email issues.

Using CakePHP's Email component

I try to send a simple Email via CakePHP's Email Component. I'm using following code from the cookbook documentation:
$this->Email->from = 'Irgendjemand <irgendjemand#example.com>';
$this->Email->to = 'Irgendjemand Anderes <irgendjemand.anderes#example.com>';
$this->Email->subject = 'Test';
$this->Email->send('Dies ist der Nachrichtenrumpf!');
The send()-method does only return a boolean value with the value false - but no error or warning occurs.
Does somebody have a solution for that?
Have you tried changing the delivery options? There are three options: mail, smtp and debug.
$this->Email->delivery = 'debug';
$this->Email->send('test message');
debug($this->Session->read('Message.email'));
You can debug with EMail. Set the delivery to debug and the email message will be set to Session.message:
if (Configure::read('debug') > 1) {
$this->Email->delivery = 'debug';
}
$ret = $this->Email->send();
if (Configure::read('debug') > 1) {
pr($this->Session->read('Message.email'));
}
Which OS are you on? If Windows, this note may be of interest:
Note: The Windows implementation of mail() differs in many ways from the Unix implementation.
...
As such, the to parameter should not be an address in the form of
"Something <someone#example.com>". The mail command may not parse this properly while talking with the MTA.
Secondly, it may just be the case that no mail server will accept outgoing mail from your local machine due to spam protection. I have often seen that the same mail() function will not work locally, but works fine once uploaded to a trustworthy server. You could try to use an authenticated mail relay in that case (SMTP).